sed -n 'h;/match/n;G;P;//D'
That will delete only the first match in any input file. It
overwrites h
old space with every line
overwrites pattern space with the next input on match lines
G
ets hold space appended to patern space
P
rints up to the first occurring \n
ewline character occurring in pattern space
D
eletes same on match lines
The thing is though, that process results in every line following the first occurrence of match to also be match before it gets the next line. So it's always matching and never printing.
sed '/match/x;//x'
That one will replace the first occurring match in a file with a blank line.
on match lines sed
ex
changes h
old and pattern spaces
if the new pattern space (old pattern space) also matches it ex
changes them again
else it leaves the first occurring match in the new h
old space and prints the blank pattern space
99
, I hope you agree, otherwise, feel free to revert. – Bernhard Aug 15 '14 at 06:25