Sed substitution bugs

Tony Finch dot at dotat.at
Tue Jun 3 07:42:29 PDT 2003


$ echo foo | sed 's/ */,/g'
,f,o,o
$

On Solaris and Linux I get ,f,o,o, (which is what I expected).
The following work correctly:

$ echo | sed 's/ */,/g'
,
$ echo foo | sed 's/ *$/,/g'
foo,
$

Here's another (related) bug:

$ echo foo | sed 's/ */,/1'
,foo
$ echo foo | sed 's/ */,/2'
,foo
$ echo foo | sed 's/ */,/3'
,foo
$ echo foo | sed 's/ */,/4'
,foo
$ echo foo | sed 's/ */,/5'
,foo
$ 

Tony.
-- 
f.a.n.finch  <dot at dotat.at>  http://dotat.at/
LUNDY FASTNET IRISH SEA: SOUTHEAST VEERING SOUTHWEST 5 TO 7, OCCASIONALLY GALE
8 AT FIRST, DECREASING 4 OR 5. RAIN. MODERATE OR GOOD.


More information about the freebsd-standards mailing list