2 ms·
Alec Thomas wrote a script like this called pawk.py (https://github.com/alecthomas/pawk https://github.com/alecthomas/pawk). It reads input automatically, and f
by benhoyt 3y ago
Alec Thomas wrote a script like this called pawk.py (https://github.com/alecthomas/pawk https://github.com/alecthomas/pawk). It reads input automatically, and for each line, defines "n" and "f" to the line number and fields list (among other things). It even supports /regex/ patterns. Even the print is implicit. So the example above would be:
pawk '/^[A-Za-z]/ (n, f[1])'
By the way, triple backticks don't work on HN. You have to indent by 2 spaces to get a code block.
- make3 3y agothanks a lot for mentioning pawk, it really looks like what I had in mind