Brian Kernighan himself, in this 2015 talk [1] on language design, states that Awk was primarily intended for one-liner usage (he mentions this at 20:43).
Brian Kernighan himself, in this 2015 talk [1] on language design, states that Awk was primarily intended for one-liner usage (he mentions this at 20:43).
Al said that if Perl had existed first there wouldn't have been an awk. I pointed out that parts of Perl are inspired by awk and might have otherwise been inspired by SNOBOL or ICON, at which point everyone present seemed to agree means we're thankful for awk. I take it as high praise when Al Aho defers to your tool.
I was just reminiscing with Larry about that discussion last week at The Perl Conference in Arlington. He said he had fond memories of that conversation and that he and Al went for lunch the next day after that conversation, too. I'd have loved to be there for that.
awk '{print $3 ":" $1 " " $2}'
in Perl? perl -aE 'say "$F[2]:$F[0] $F[1]"' perl -nae'printf("%s:%s %s\n",$F[2],$F[0],$F[1])' $ txr -e '(awk ((prn `@[f 2]:@[f 0] @[f 1]`)))'
1 2 3
3:1 2
How about input from a string stream? At the REPL: 1> (with-in-string-stream (*stdin* "1 2 3")
(awk ((prn `@[f 2]:@[f 0] @[f 1]`))))
3:1 2
nil
It pays not to have awk be some some canned global behavior enabled by a command line option. txr -e '(awk (:set ofs "") ((prn [f 2] ":" [f 0] " " [f 1])))'
This is like: awk -v OFS= '{print $3, ":", $1, " ", $2}'