Problem with sed

Matthew Seaman matthew at FreeBSD.org
Mon May 18 13:31:50 UTC 2015


On 2015/05/18 14:00, Jerry wrote:
> 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
> 
> and get this error:
> 
> sed: 1: "/var/tmp/myfile.txt": undefined label 'mp/myfile.txt'
> 
> I don't understand why. I am following the example I found in the "sed & awk" handbook by "O'Reilly"
> 

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

You're getting sed(1) confused as to what is the extension for the
backup of the file it creates, what the command you want to rn is and
what the input filename is.  Also, you need to put some characters of
syntactic significance to the shell inside quote marks.

	Cheers,

	Matthew


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1012 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20150518/8e5fd753/attachment.sig>


More information about the freebsd-questions mailing list