Created
August 25, 2015 19:38
-
-
Save garethrees/f953a547df2639a9c7fc to your computer and use it in GitHub Desktop.
sed: Delete After Word
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sed ' | |
/ONE/ { | |
# append a line | |
N | |
# if TWO found, delete the first line | |
/\n.*TWO/ D | |
}' file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment