I have a text file. In case there are more than one consecutive line that starts with @, I want to delete all these lines, except of the last occurrence of of a line with @.
For example, lets say I have input file:
abc
@abc
@def
333
@asd
@poi
@789
The output should be:
abc
@def
333
@789
I saw awk tag. so I add an awk one-liner, which could sovle your problem: (see test below)