[Gllug] Help with sed

Christopher Mocock chris at wavestore.com
Fri Aug 21 09:21:23 UTC 2009


Andrew Roberts wrote:
> Some alternative solutions:
>   sed '/\[Lang_[0-9]\]/ { n; s/Lang=.*$/Lang=pt/ }' testfile
>   awk '/\[Lang_[0-9]\]/ { print; getline; if ($0 ~ /Lang=/) $0="Lang=pt" 
> }1' testfile

The sed one worked a treat and was much more concise than my ed 
alternative. Didn't try the awk one but I guess it's equivalent.

Thanks for your help.

-- 
Chris
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list