Skip to content

Instantly share code, notes, and snippets.

@andrewrcollins
Created January 11, 2012 04:22
Show Gist options
  • Save andrewrcollins/1592991 to your computer and use it in GitHub Desktop.
Save andrewrcollins/1592991 to your computer and use it in GitHub Desktop.
ltrim(), rtrim(), and trim() in awk
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
}
@akaBilih
Copy link

akaBilih commented May 2, 2024

Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment