awk question

Quartz quartz at sneakertech.com
Mon Oct 5 09:35:56 UTC 2015


> Funny you mention grep, I had a similar conversation on the NetBSD list
> last week & everyone there suggested using awk alone to 'grep' out the
> lines I wanted.

Awk, sed, and various other utilities all have basic regex line 
matching, so if you're already calling them for some other feature then 
piping the output through grep first is kinda silly and inefficient. 
It's sorta like doing $(cat foo.txt | grep 'bar') instead of just $(grep 
'bar' foo.txt). I suggested it mainly because it's easy to understand 
conceptually and because awk's syntax has something of a steep learning 
curve.



More information about the freebsd-questions mailing list