Thursday, January 11, 2007

Useful short shell scripts

Useful short shell scripts:

grep -n Unexpected Csv2_parse.c | awk -F: '{print "b Csv2_parse.c:"$1}'

This finds all examples of "Unexpected" in the file Csv2_parse.c, and converts the grep output into an input for gdb so I can make all of these lines breakpoints.

for a in [1-9]* ; do cat $a | awk -F\> '{a++} /Label\:/ {a=1} a==3{print "'$a' "$4}' | cut -f1 -d\< | sed 's/.html//' | grep [a-zA-Z] ; done > Label.list

This script, run in a directory with all of the SACD entries in sa-cd net in a single directory, gord through all of the HTML files and tells us the label for each and every SACD, in a single file named "Label.list"