Opengist

Explore

  • All gists
  • Topics
  • Users
Give feedback on the new UI Powered by Opengist ⋅ 31ms

user:thomas gists created by user

title:mygist gists with given title

description:sync gists with given description

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

all:systemctl search all fields

Login Register
a

awk

Recently created Least recently created Recently updated Least recently updated
anthony

anthony / ltrim(), rtrim(), and trim() in awk

Last active 1 month ago awk shell

Taken from https://gist.github.com/andrewrcollins/1592991

0 0 1
1 function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s }
2 function rtrim(s) { sub(/[ \t\r\n]+$/, "", s); return s }
3 function trim(s) { return rtrim(ltrim(s)); }
4 BEGIN {
5 # whatever
6 }
7 {
8 # whatever
9 }
10 END {