Skip to content

Instantly share code, notes, and snippets.

@packetchef
Last active August 1, 2020 16:19
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 packetchef/5a76e543374caca8fadce5f13bab5ecb to your computer and use it in GitHub Desktop.
Save packetchef/5a76e543374caca8fadce5f13bab5ecb to your computer and use it in GitHub Desktop.
# For the string "abc:123", append "def" to "abc"
$ echo "abc:123" | sed 's/abc/&def/'
# Add a space after every alphanumeric character
$ echo "abc:123" | sed 's/[A-Za-z0-9]/& /g'
# Use stdin instead of passing a file
$ sed 's/abc/def/' <&1
abcdefghi
defdefghi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment