Created
December 13, 2011 04:04
-
-
Save viktorkelemen/1470513 to your computer and use it in GitHub Desktop.
Replace line break with comma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inline | |
echo 'id1\nid2\nid3' | tr -s '\n\r' ',' | |
# From file | |
cat ids_width_linebreaks.txt | tr -s '\n\r' ',' | |
# From/to a file | |
tr -s '\n\r' ',' < ids_with_linebreaks.txt > ids_with_commas.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment