Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Here's a more verbose version of essentially the same thing, hopefully using more readable syntax:
- awk '{
- lastLine = currentLine;
- currentLine = $0;
- }
- /foo|bar/ \
- {
- getline currentLine
- next
- }
- NR > 1 \
- {
- print lastLine;
- }
- END \
- {
- if ( currentLine !~ /foo|bar/ )
- print currentLine;
- }
- ' file.txt
Add Comment
Please, Sign In to add comment