# QTAwk Utility To Rapidly Find And Process Clusters Of Records.
# Record Cluster Start Found By Matching FILE_SEARCH_PAT
BEGIN {
FILE_SEARCH = TRUE;
FILE_SEARCH_PAT[1] = /search pattern 1/;
FILE_SEARCH_PAT[2] = /search pattern 2/;
FILE_SEARCH_PAT[3] = /search pattern 3/;
FILE_SEARCH_PAT[4] = /search pattern 4/;
FILE_SEARCH_PAT[5] = /search pattern 5/;
}
# Have Found First Record Matching A Pattern In
# FILE_SEARCH_PAT. Turn File Search Mode Off
# And Process Range Of Records Normally
FILE_SEARCH {
FILE_SEARCH = FALSE;
. # actions to be taken on record matching
. # FILE_SEARCH_PAT
.
.
.
.
.
# Delete Next Statement If Record Matching FILE_SEARCH_PAT Is
# To Be Matched Against Patterns
next;
}
# Pattern/Actions For Records To Be Processed Normally
pattern1 {
# actions
}
pattern2 {
# actions
}
.
.
.
# Pattern/Action For Last Record In Range
# Reset FILE_SEARCH To True To Resume
# File Search Mode. May Also Set FILE_SEARCH_PAT
# To Alter Matching Conditions For Next Record Cluster
pattern_l {
FILE_SEARCH = TRUE;
.
.
.
}