Created
January 11, 2012 04:22
-
-
Save andrewrcollins/1592991 to your computer and use it in GitHub Desktop.
ltrim(), rtrim(), and trim() in awk
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
function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s } | |
function rtrim(s) { sub(/[ \t\r\n]+$/, "", s); return s } | |
function trim(s) { return rtrim(ltrim(s)); } | |
BEGIN { | |
# whatever | |
} | |
{ | |
# whatever | |
} | |
END { | |
# whatever | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!!