[plug] sed or awk
Leon Brooks
leon at brooks.fdns.net
Mon Jan 15 17:04:33 WST 2001
Rob Dunne wrote:
> can anyone tell me how to replace repeated occurances of
> that same pattern with a different replacement pattern?
> ie
> the first "1" is replaced with "1"
> the second "1" is replaced with "2"
> the third "1" is replaced with "3"
I could be unimaginitive and tell you to just do multiple passes:
sed <source.txt -e 's/111/123/g' -e 's/11/12/g' >modified.txt
--
Remember, a closed mouth gathers no foot. -- Steve Post
More information about the plug
mailing list