search_replace and sed

alex at 22-music.de alex at 22-music.de
Wed Mar 24 04:04:25 PST 2004


On 24.03.04 11:42 +0100, Reinhard wrote:
> Hello,
> 
> what is the best equivalent for <search_replace> ?
> sed -i s/.../.../ filename
> 	or
> sed -i s/.../.../g filename
> 
The 'g' makes only one difference: without it, only one occurence of
'...' in a line is replaced:

AABBAA -> sed s/AA/CC/  -> CCBBAA
AABBAA -> sed s/AA/CC/g -> CCBBCC

That's all!

LX
> 
> Kind regards
> 
> Reinhard
> 
> -- 
> http://linuxfromscratch.org/mailman/listinfo/alfs-discuss
> FAQ: http://www.linuxfromscratch.org/faq/
> Unsubscribe: See the above information page



More information about the alfs-discuss mailing list