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
}
@andyxning
Copy link

awesome!

@elgholm
Copy link

elgholm commented Sep 22, 2015

Thx!

@islamouahouda
Copy link

Thanks great work !

@michto01
Copy link

michto01 commented Nov 3, 2016

Thx!

@luisco
Copy link

luisco commented Jun 8, 2017

Excellent, thanks

@moijes12
Copy link

Thanks 👍

@kdcc
Copy link

kdcc commented Feb 27, 2018

Fantastic! @

@RezoApio
Copy link

RezoApio commented Mar 5, 2018

Really useful! Thanks a lot

@noobbbbb
Copy link

Thx!

@LeeYunhang
Copy link

Thank you very much, man.

@aselvan
Copy link

aselvan commented Apr 2, 2023

Nice!

@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