File tree Expand file tree Collapse file tree 6 files changed +6
-0
lines changed
individual-shell-tools/sed Expand file tree Collapse file tree 6 files changed +6
-0
lines changed Original file line number Diff line number Diff line change 33set -euo pipefail
44
55# TODO: Write a command to output input.txt with all occurrences of the letter `i` replaced with `I`.
6+ sed ' s/i/I/g' input.txt
67# The output should contain 11 lines.
78# The first line of the output should be: "ThIs Is a sample fIle for experImentIng with sed.".
Original file line number Diff line number Diff line change 33set -euo pipefail
44
55# TODO: Write a command to output input.txt with numbers removed.
6+ sed ' s/[0-9]//g' input.txt
67# The output should contain 11 lines.
78# Line 6 of the output should be " Alisha".
Original file line number Diff line number Diff line change 33set -euo pipefail
44
55# TODO: Write a command to output input.txt removing any line which contains a number.
6+ sed ' /[0-9]/d' input.txt
67# The output should contain 6 lines.
Original file line number Diff line number Diff line change 33set -euo pipefail
44
55# TODO: Write a command to output input.txt replacing every occurrence of the string "We'll" with "We will".
6+ sed " s/We'll/We will/g" input.txt
67# The output should contain 11 lines.
Original file line number Diff line number Diff line change 33set -euo pipefail
44
55# TODO: Write a command to output input.txt with one change:
6+ sed ' s/^\([0-9]\+\) \(.*\)/\2 \1/' input.txt
67# If a line starts with a number and a space, make the line instead end with a space and the number.
78# So line 6 which currently reads "37 Alisha" should instead read "Alisha 37".
89# The output should contain 11 lines.
Original file line number Diff line number Diff line change 33set -euo pipefail
44
55# TODO: Write a command to output input.txt with one fix:
6+ sed ' s/,\([^ ]\)/, \1/g' input.txt
67# If a comma in input.txt is not followed by a space, add a space after.
78# If there is already a space after a comma, do not add an additional space.
89# The output should contain 11 lines.
You can’t perform that action at this time.
0 commit comments