Deleting a line from a file

Saket Sinha saket.sinha89 at gmail.com
Wed May 14 10:28:49 EDT 2014


Hi,

    I have a file that has entries for different absolute path on
separate lines. eg:
/opt/new1
/opt/new2

I need to delete an entry from this file for a given path, for which I
am using sed.

sed -i 's#^/opt/new1.*$##g' file_entries.txt

However this is leaving blank line in between, which I don't want.

Can someone help me to do this without leaving blank lines in between.

Regards,
Saket Sinha



More information about the Kernelnewbies mailing list