Skip to content

Instantly share code, notes, and snippets.

@jgyllen
Created November 22, 2011 18:55
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 jgyllen/1386534 to your computer and use it in GitHub Desktop.
Save jgyllen/1386534 to your computer and use it in GitHub Desktop.
sed commands
# Find rows containing string 'foo' in file bar.txt
$ sed -n '/foo/p' < bar.txt
# Replace occurrences of 'foo' with 'bar' in baz.txt and backup original to baz.txt.bak
$ sed -i.bak -e 's%foo%bar%' baz.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment