I know this is awk, however, since it is closely related to sed...
How do you comment multiple lines at once?
For example:
And you want to comment lines 2, 4, and 7.
will comment line two
or
will comment lines 2,3,4
But how to get 2, 4, and 7 at once?
How do you comment multiple lines at once?
For example:
Code:
# cat text
line 1
line 2
line 3
line 4
line 5
line 6
line 7
And you want to comment lines 2, 4, and 7.
Code:
# sed -i'2 s/^line/#/' text
or
Code:
# sed -i '2,4 s/^line/#/' text
But how to get 2, 4, and 7 at once?