Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 May 2015 09:11:11 -0400 (EDT)
From:      Thomas Dickey <dickey@his.com>
To:        FreeBSD FreeBSD <freebsd-questions@freebsd.org>
Subject:   Re: Problem with sed
Message-ID:  <1038227648.10325165.1431954671299.JavaMail.root@his.com>
In-Reply-To: <20150518090051.6600f32a@seibercom.net>

next in thread | previous in thread | raw e-mail | index | archive | help
----- Original Message -----
| From: "Jerry" <jerry@seibercom.net>
| To: "FreeBSD FreeBSD" <freebsd-questions@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@invisible-island.net>
http://invisible-island.net
ftp://invisible-island.net



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1038227648.10325165.1431954671299.JavaMail.root>