Skip to content

Instantly share code, notes, and snippets.

@EvanKrall
Created September 29, 2011 23:07
Show Gist options
  • Save EvanKrall/1252186 to your computer and use it in GitHub Desktop.
Save EvanKrall/1252186 to your computer and use it in GitHub Desktop.
Delete a regexp and optionally a blank line after it.
#!/bin/bash
regex="$1"
filename="$2"
sed --separate --in-place "/^${regex}\$/,+1{
/^${regex}\$/d
/^\$/d
}" "$filename"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment