1# $Id: txn.awk,v 12.0 2004/11/17 03:43:25 bostic Exp $ 2# 3# Print out all the records for a comma-separated list of transaction ids. 4NR == 1 { 5 ntxns = 0 6 while ((ndx = index(TXN, ",")) != 0) { 7 txn[ntxns] = substr(TXN, 1, ndx - 1); 8 TXN = substr(TXN, ndx + 1, length(TXN) - ndx); 9 ntxns++ 10 } 11 txn[ntxns] = TXN; 12} 13 14/^\[/{ 15 if (printme == 1) { 16 printf("%s\n", rec); 17 printme = 0 18 } 19 rec = ""; 20 21 for (i = 0; i <= ntxns; i++) 22 if (txn[i] == $5) { 23 rec = $0 24 printme = 1 25 } 26} 27/^ /{ 28 rec = sprintf("%s\n%s", rec, $0); 29} 30 31END { 32 if (printme == 1) 33 printf("%s\n", rec); 34} 35