From mboxrd@z Thu Jan 1 00:00:00 1970 From: bernd@petrovitsch.priv.at (Bernd Petrovitsch) Date: Wed, 14 May 2014 16:34:20 +0200 Subject: Deleting a line from a file In-Reply-To: References: Message-ID: <1400078060.18277.40.camel@thorin> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org Hi! The original mail is off-topic as it has nothing to do wotj the Linux kernel development as such, but: On Mit, 2014-05-14 at 19:58 +0530, Saket Sinha wrote: [...] > 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. sed -i 's#^/opt/new1.*$#d' file_entries.txt should do it .... Bernd -- Bernd Petrovitsch Email : bernd at petrovitsch.priv.at LUGA : http://www.luga.at