I have an include file that has 50+ #defines with constants (0,1,2,3,…,etc). I have a dump program to dump the data structure that these #defines are used in into a .csv file. I used this little script to dump case statements out for the #defines, with readable strings instead of arbitrary constant values.cat | awk [...]
I was trying to maintain a program that wrote 200+ lines to a single file, using a single repeated function call–many of which had all NULL parameters. There were also occasional loops involved. The data was position based, so NULL writes counted.I was just trying to figure out:How many times a given function was called.At [...]
This, at present, is overly simplistic and makes many stupid assumptions:That the return type is short.That there are no short global variables declared.That everything is well-formatted so that the return type is always first column, and that there is a space between both function name and return type (as in, only spaces–no comments) and function [...]
This script chops off the last dir off of the PATH (still need to assign back to PATH)echo $PATH | gawk -F’:’ ‘{ for(i=1; i<NF; i++) { if(i) { printf (":"); } printf("%s", $i); }}’