Created
January 9, 2014 02:28
-
-
Save coderofsalvation/8328455 to your computer and use it in GitHub Desktop.
remove leading and trailing whitespaces
This file contains hidden or 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 whitespaces | |
| # usage: echo " foo bar " | trim | |
| trim(){ | |
| cat - | sed -e 's/^ *//g' -e 's/ *$//g' | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment