The LIGOtools "dataflow" package includes a utility called 'lwtcut' which lets you select a subset of rows from a LIGO_LW table file, based on row number and/or a numeric or string comparison involving one of the column values. (The ability to do string comparisons was added in version 5.3 of the "dataflow" package.) You can write the matching rows to a new LIGO_LW file, or you can simply have the number of matching rows printed to standard output. For example:
pshawhan@sheratan> lwtcut L1-INSPIRAL_100.xml 22083 rows <-- total number of rows in file pshawhan@sheratan> lwtcut L1-INSPIRAL_100.xml 'snr >= 10' 3827 rows <-- number of rows with snr >= 10 pshawhan@sheratan> lwtcut L1-INSPIRAL_100.xml 'snr >= 10' -o big_events.xml 3827 rows written to big_events.xml pshawhan@sheratan> lwtcut H1H2L1events.xml 'ifo == L1' -o L1events.xml 1288 rows written to L1events.xml
If the input file contains more than one Table, and you want to select rows from a table other than the first one in the file, you will need to use the '-t' option.
Type 'lwtcut' without any arguments for complete syntax information.