Problem with sed

Thomas Dickey dickey at his.com
Mon May 18 13:18:55 UTC 2015


----- Original Message -----
| From: "Jerry" <jerry at seibercom.net>
| To: "FreeBSD FreeBSD" <freebsd-questions at freebsd.org>
| Sent: Monday, May 18, 2015 9:00:51 AM
| Subject: Problem with sed
| 
| I rarely use sed, so I admit to not being fully acquainted with its
| idiosyncrasies,; however, this one is really annoying.
| 
| I am using this command in an attempt to remove empty lines:
| 
| $ sed -i /^$/d /var/tmp/myfile.txt

you have to quote the expression to prevent the '^' and '$' characters from being interpreted by the shell,
for example 

sed -i '/^$/d' /var/tmp/myfile.txt


-- 
Thomas E. Dickey <dickey at invisible-island.net>
http://invisible-island.net
ftp://invisible-island.net


More information about the freebsd-questions mailing list