sed not working

Rein Kadastik wigry at uninet.ee
Sat Sep 3 02:27:47 PDT 2005


Hi,

I have a very interesing problem with sed in FreeBSD.

Lets take the following sed command (from the ncurses MKlib_gen.sh script):

sed -e '/^\([a-z_][a-z_]*\) /s//\1 gen_/'

This command alters the input:
blah something -> blah gen_something

This works, but I have found a specific pattern, where it does not work:
int something -> int something

Does anybody have any idea, what would be the cause of the problem and 
how to fix it.

I also have several other FreeBSD systems, where the sed behaves 
correctly. I  also copied the sed over to the broken system, but no luck.

The broken system used to be 4.6-STABLE and I managed to upgrade it to 
4.11-RELEASE-p11 (without working sed). I hoped that upgrade procedure 
would elliminate the problem, but apparently not.

"which sed" points to /usr/bin/sed

"ident /usr/bin/sed" output:
# ident /usr/bin/sed
/usr/bin/sed:
     $FreeBSD: src/usr.bin/sed/compile.c,v 1.13.2.8 2002/08/17 05:47:06 
tjr Exp $
     $FreeBSD: src/usr.bin/sed/main.c,v 1.9.2.7 2002/08/06 10:03:29 fanf 
Exp $
     $FreeBSD: src/usr.bin/sed/misc.c,v 1.3.2.2 2002/07/17 09:35:56 tjr 
Exp $
     $FreeBSD: src/usr.bin/sed/process.c,v 1.10.2.11 2004/01/10 06:30:37 
tjr Exp $

I suspect, that it is some sort of a regex library issue as sed does not 
contain its own regex engine.

-- Rein



More information about the freebsd-hackers mailing list