Subject: Question about NetBSDs implementation of sed.
To: None <netbsd-help@NetBSD.org>
From: Glen Johnson <gjohnson@valcom.com>
List: netbsd-help
Date: 03/14/2007 14:32:29
NetBSD-help,
I am learning how to use sed and can't seem to figure out how to have
sed stop on word boundaries. Yes, I read both man sed and man 7
re_format. I am at a loss. I went on line and googled for my
solution. From there I came up with some possibilities but nothing
seems to work for NetBSDs sed. Here they are:
I made a small file to test with:
j.txt
----
This is junk
This is the junkiest!
This is prejunk
Trial #1:
--------
$ sed -E 's/junk\b/great/' j.txt
This is junk
This is the junkiest!
This is prejunk
BUT, you say \b is in the GNU implementation. Very true but I had to try.
Trial #2
--------
~/junk> sed -E 's/\<junk\>/great\!/' j.txt
This is junk
This is the junkiest!
This is prejunk
The \< \> is even mentioned in NetBSDs grep, and ed man pages. I
thought this had to be it. Still wrong answer. What about the -E that
isn't that supposed to enable extended regular expressions?
So how does one use sed to search on word boundaries?
Eager to learn,
Glen Johnson