I'm trying to delete matching patterns, starting from the second occurrence, using sed
or awk
. The input file contains the information below:
abc
def
abc
ghi
jkl
abc
xyz
abc
I want to the delete the pattern abc
from the second instance. The output should be as below:
abc
def
ghi
jkl
xyz