Created
June 19, 2013 06:12
-
-
Save phx/5812027 to your computer and use it in GitHub Desktop.
remove extra whitespaces
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
#!/bin/bash | |
# removes all "extra" whitespace (leaves normal spaces) | |
cat "web.txt" | awk '{$1=$1}1' | |
# removes only leading and trailing whitespace | |
cat "web.txt" | awk '{gsub(/^ +| +$/,"")}1' | |
# this perl command should do the same thing | |
cat "web.txt" | perl -lape 's/^\s+|\s+$//g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment