Consider the below configuration file and it has two instances of alt_names
. Here, I want to delete a line with second occurrence of a pattern alt_names
.
.
.
[ server ]
subjectAltName = @alt_names
.
.
[ alt_names ]
I tried sed
command but it deletes all the lines with the pattern occurrence. I used the below command to do so,
#sed '/alt_names/{2,$d}' inputfile
Can some shed lights on whats gone wrong the usage of sed
here.