Saturday, January 26, 2008

Using awk, gawk to print multiple matching lines in multiple files

This basically prints the trio of source, destination and include only
when include either contains libnmt.a or libnml.a

egrep -e 'source|destination|include' *.map.xml | awk '/source/ {SRC=$0}; /destination/ { DEST=$0}; /libnmt\.a/ || /libnml\.a/ { print SRC "\n" DEST "\n" $0}'

No comments: