I have a text file test.txttest.txt with something like the following:
foo configure top start fun bar hello I want to comment out line numbers 2, 5 &and 7. So, so that the output shouldwould look like:
foo #configure top start #fun bar #hello When I use sed -i "2,7 {s/^/#/}" test.txt lines 2,3 3,4 4,5 5,6 & 6 and 7 get commented. How to ensure only specific line numbers are commented? Appreciate any help.