News for hackers. Stuff that matters.
Re:Shell Script Best Practices, from a decade of scripting t... by foobarian on Thursday October 27, 2022 @10:31AM (#33358035)
All you need to do is learn that cmd | awk '{ $5 }' will print out the 5th word as delimited by one or more whitespace characters. Regexes support this easily but are cumbersome to write on the command line.
Re:Shell Script Best Practices, from a decade of scripting t... by bravetraveler on Thursday October 27, 2022 @11:37AM (#33359200)
Doing that, maybe with some inline concatenation to make a new structure, and this are about all I use:

Printing based on another field, example gets UIDs >= 1000:

    awk -F: '$3 >= 1000 {print $0}' /etc/passwd
It can do plenty of magic, but knowing how to pull fields, concat them together, and select based on them cover like 99% of the things I hope to do with it
Re:Shell Script Best Practices, from a decade of scripting t... by every on Thursday October 27, 2022 @12:00PM (#33359559)
And don't forget the invisible $0 field in awk...
Re:Shell Script Best Practices, from a decade of scripting t... by fluential on Sunday October 30, 2022 @08:24AM (#33393817)
And $NF