Hi lenjturnbull,
I wrote the following script for you on my break. It hasn't been tested as I have to get back to work. There are a couple of known issues, which I have commented.
You can run this script to specify that you want to exclude a particular entry (pass the word 'delete' as the first command line argument), or to display only that entry (default).
When you run it, it prints out a list of customers, based on $7 in the ISA line. This may need to be fixed if you have more than 24 (a screenful) of customers.
Syntax:
% my.awk [delete] file
Script:
% cat my.awk
#!/usr/bin/awk -f
# USAGE: my.awk [delete] file
BEGIN{
# Check for option command line argument (delete):
if (ARGV[ARGC-2]=="delete"
{
mode="delete";
delete ARGV[ARGC-2];
}
while ( ( getline < ARGV[ARGC-1] ) > 0 )
{
if ($0) ~ /^ISA/)
{
print $7; # To fix: May scroll off screen.
custarr[$7]=1;
}
}
close (ARGV[ARGC-1]);
do
{
printf("Select one: "

;
getline customer < "-"; # Syntax does not work everywhere.
if ( ! customer in custarr )
{
print "Customer " customer " does not exist.";
print "Please try again...";
}
}while ( customer in custarr )
}
/^ISA/ {
do
{
if ( ($7 == customer) && (mode!="delete"

)
{
print $0;
}
else if ( ($7 != customer) && (mode=="delete) )
{
print $0;
}
if $0 ~ /^IEA/ { break; }
}while ( ( getline ) > 0 )
}
Hope this helps,
Grant.