Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Created January 9, 2014 12:30
Show Gist options
  • Select an option

  • Save coderofsalvation/8333389 to your computer and use it in GitHub Desktop.

Select an option

Save coderofsalvation/8333389 to your computer and use it in GitHub Desktop.
replaces newlines (enters) in string with given parameter
# replaces newlines (enters) in string with given parameter
# usage: cat file.txt | replacenewlines ","
replacenewlines(){
cat - | sed ':a;N;$!ba;s/\n/"$1"/g'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment