You can use python as if it is awk with PyAwk.
All you have to do is make a script file and create a class which extends PyAwk class and write some procedures like awk.
PyAwk supports below function.
- begin and end syntax which are called only once in a execution.
- awk specific valiables like FILENAME, FS, OFS, RS, ORS, NF, NR, FNR.
- command line options like debug mode, set valiables.
- SQLite3 query.
If you see examples, you would learn more how to use PyAwk.