around 4 months back, i started dusting off whatever bit of awk that i learnt in 1997. dint take more than an hour to get a decent grip and could start writing some meaningful scripts.
then, like how a person with hammer sees every problem as nail, I started looking out for problems that i could solve using my newly acquired weapon. there were plenty. not just problems, but could do quite a bit of new things that would be too difficult to do with java and bit difficult with python. Above all I like awk’s simplicity. After all it is written by 3 demigods (Aho, Weinberger & kernighan)
Let me end this post by writing a few words on one of my awk exploits. In the legacy code that we have, the SQL statements are spewed all over the code. MVC has been violated to the extent possible. Whenever we add a new column to a table, we have a tough time figuring out all jsp that has code to access this table and make changes to it.
So I wrote an awk script that would provide such a report 1. In each jsp file, the db tables used.
2. For each db table, the number of jsp files that accesses this table.
3. In both the cases the line number and the CRUD information.
It is really worth spending some time learning and becoming comfortable with any scripting language. The productivity gains are enormous and it is more fun writing these scripts. In the forthcoming posts, I will write in more detail about some of the scripts.