CRSSTATM: Fun with Awk

by Seth Miller

If you are not familiar with “awk” (actually “gawk” in Linux), you are missing out a very powerful and versatile interpretive language. It looks cumbersome at first but once you get a grasp of the basic concepts, it is quite simple. The authors (who very unoriginally used the first letters of their surnames to come up with “awk”; Alfred Aho, Peter Weinberger, and Brian Kernighan) intentionally made it that way.

I use “crs_stat” filtered through an awk script to columnize the output quite often but I ran into an issue recently. I have a development RAC farm hosting 40 databases and growing. That means crs_stat has no less than 50 resources to list at any one time and that number is only growing. Needless to say, scrolling to see the output of the script was always necessary and forget about using “watch” since “watch” will only display the first X number of lines that will fit on the screen.

I decided to write my own interpretation of “crs_stat”. I wanted to be able to see at least 60 resources on one screen so I could actively watch the resources using “watch” with my script. The script below is meant to serve two purposes. First I wanted the functionality described here. Secondly, I added a heavy amount of documentation to help those just getting started in “awk” to understand the basic functionality of the language. Feel free to use, modify and provide feedback.