3 ms·
Or just use either a small wrapper to provide awk-like functionality, or an interpreter with explicit options for awk-like functionality. E.g. Perl and Ruby "-
by vidarh 7y ago
Or just use either a small wrapper to provide awk-like functionality, or an interpreter with explicit options for awk-like functionality.
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.