5

Sed : Replace pattern on every second occurence?

view full story
linux-howto

http://unix.stackexchange.com – Is there a way to tell sed to replace the a pattern on every second occurence ? Or a least on every second line ? (Sure it's possible with a script, but I was asking my self if sed can do it to). Thx Edit : I found sed -e "s/pattern/replacement/g;n" but it replace every first occurence, not the second. (HowTos)