I've created an awk script that handles a varying number of search strings handed to it as command line parameters ($1 $2 etc). There may be 1, or 2 or 3 or more. A simplified version of the script is:
awk -v TYP="$1 $2 $3 $4 $5 $6" '
BEGIN {
CTYP = split (TYP,TYPP," ")
}
{for ( i=1; i <= CTYP; i++ ) {
if ($0 ~ TYPP) {print; break}
}}
' file1 > file2
exit 0
This works, but is not efficient at all.
Could someone suggested an alternate method to handle this scenario? Any help is appreciated.
Thank you.