21 Feb

sed: remove a line / remove an empty line

To remove empty lines run:

sed '/^$/d' /home/dandelion/itsfile.txt

To remove lines matching the pattern:

sed '/patter/d' /home/dandelion/itsfile.txt

Add -i option to remove in a file itself, instead of printing the output to stdout.

 



Leave a Reply

Your email address will not be published. Required fields are marked *