Last active
August 29, 2015 14:04
-
-
Save mayurah/2565f55ae695ea56b97a to your computer and use it in GitHub Desktop.
Sed one-liner
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
Remove leading and trailing whitespace | |
# sed 's/^[ \t]*//;s/[ \t]*$//' filename | |
Replace newline (\n) with ",," (imperfect) | |
# sed ':a;N;$!ba;s/\n/,/g' filename | |
simple replace ",," with newline (\n) | |
# sed 's/,,/\n/g' filename | |
prepend "##" to each line | |
# sed 's/^/##/' filename | |
** more sources ** | |
* http://sed.sourceforge.net/sed1line.txt | |
* http://www-rohan.sdsu.edu/doc/sed.html | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment