Literally every time I use awk I have to google the syntax because I don't use it often enough for it to persist in long term memory.
If only awk's syntax were a subset of a language I already knew, like python or JS
Literally every time I use awk I have to google the syntax because I don't use it often enough for it to persist in long term memory.
If only awk's syntax were a subset of a language I already knew, like python or JS
E.g. Perl and Ruby "-pe"/"-pie" command line options, and assorted related variations both offers ways to do awk-like single-liners that are just minor syntactic sugar over full scripts. But writing a tiny wrapper like that for your preferred language should be easy enough.
"ruby -an -F: -e ' puts $F[0] '" is equivalent to awk -F: ' { print $1 } ' for example
-n adds an implicit "while gets(); ...; end" loop; gets by default sets $_; -n adds an implicit $F = $_.split($;); -F sets $; ; -e takes what follows as a Ruby expression.
Not necessarily—sometimes it makes sense to use Datalog instead of Prolog, for example.