Question about NetBSDs implementation of sed.

Glen Johnson <[email protected]>
Newsgroups gmane.os.netbsd.help
Organization Valcom, INC.
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.