On 2016-04-23 15:21, Jonathan Gray wrote:
> $ cat foo.sh
> #!/bin/sh
> 
> $1 -r '
> s/[[:space:]]//g
> s/\<sf([0-9]+),/ISL_SFLOAT@\1,/g
> '
> $ cat foo.csv
> R32G32B32A32_FLOAT          , 128,  1,  1,  1, sf32, sf32, sf32,
> sf32,     ,     ,    , linear, $ ./foo.sh sed < foo.csv 
> R32G32B32A32_FLOAT,128,1,1,1,ISL_SFLOAT@32,sf32,ISL_SFLOAT@32,sf32,,,,linear,
> $ ./foo.sh gsed < foo.csv
> R32G32B32A32_FLOAT,128,1,1,1,ISL_SFLOAT@32,ISL_SFLOAT@32,ISL_SFLOAT@32,ISL_SFLOAT@32,,,,linear,

Can be simplified to the test-case

 $ echo a,a,a,a,a | sed -r 's/\<.,/X&/g'
 Xa,a,Xa,a,a
 $ echo a,a,a,a,a | gsed -r 's/\<.,/X&/g'
 Xa,Xa,Xa,Xa,a

It appears the determination of "\<" can get thrown off when the
character preceding it is part of a replacement.

-tkc



Reply via email to