#!/usr/bin/ksh cat file | while read i do file_name=`echo $i | awk -F"|" '{print $1}'` #get the file_name export type=`echo $i | awk -F"|" '{print $2}'` #get the customer type setting for the file perl -nle '/TABLE/ && print "$ARGV:$_:@ARGV"' $file_name $type done