If something takes more than one line of awk, I probably don’t want to use awk.
My copy of Aho, Kernighan, and Weinberger has this one-liner pencilled on the back page. I've never found a simpler way to find the longest pathnames in a directory tree:
find . | awk '{print length($0) " " $0}' | sort -r -n
As I remember, I once prototyped a COBOL pretty-printer in Awk. That was more than a one-liner.
No comments:
Post a Comment