Skip to content

Instantly share code, notes, and snippets.

@garethrees
Created August 25, 2015 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garethrees/f953a547df2639a9c7fc to your computer and use it in GitHub Desktop.
Save garethrees/f953a547df2639a9c7fc to your computer and use it in GitHub Desktop.
sed: Delete After Word
#!/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