awk is also interesting because it's not just a language, it's a "model". It isn't something that you can't write with some lines of any other language but, because the loop is embedded, makes it easier to write utilities for the command line.
#!/usr/bin/python3
import re, sys, json, other, useful, packages
def printf(s):
print(s.format(**globals()))
for NR, line in enumerate(sys.stdin):
match = eval(sys.argv[1])
if match:
eval(sys.argv[2])
Then you can use this in command line as somecommand | pyawk.py "re.search(r'^(pattern)\s(otherpattern)', line)" "printf('{NR}) {match[1]}')"
I deliberately didn't pass pattern straight into re.search but rather provides the option to do other forms of parsing/matching in that argument, for example json parsing. I just spent 2 minutes writing this script so it's obviously not perfect and you probably won't be able to use it for json out of the box but give it a few more iterations and it will most likely work. $ echo -e $'line one\nline two' | ruby -ne 'puts $_.split(/\W+/)[1]'
one
tworuby inherited a lot of structure and ideas from perl which it inherited from awk and that thought makes me irrationally happy