echo "foobar foo bar" | sed 's/foo/@foo/g; s/bar/@bar/g; s/@foo/bar/g;
s/@bar/foo/g'

based on:
http://stackoverflow.com/questions/13991017/swap-two-strings-simultaneously
found through:
https://www.google.co.il/search?q=sed+swap+foo+and+bar

חג שמח,
Eliyahu - אליהו

2013/9/25 vordoo <[email protected]>:
> Hi,
>
> I know how to: sed -i 's/foo/bar/g' *.txt
>
> But how do I: replace string foo to bar AND bar to foo in the same file??
>
> Thanks!
>
> _______________________________________________
> Linux-il mailing list
> [email protected]
> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>

_______________________________________________
Linux-il mailing list
[email protected]
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il

Reply via email to