The following script portion read each line in $next. But when I try to grep particular pattern i.e. "MO" in $next, the error is shown on standard output as
grep: 40922|OPR: No such file or directory
grep: MO: No such file or directory
grep: 12345|OPR: No such file or directory
grep: MO: No such file or directory
grep: 12345|12345|202|local|LMNO: No such file or directory
cat /home/scripts/$E1.out | while read next
do
i=`echo $next | awk -F"|" '{print($1)}'`
j=`echo $next | awk -F"|" '{print($2)}'`
k=`echo $next | awk -F"|" '{print($3)}'`
l=`echo $next | awk -F"|" '{print($4)}'`
m=`echo $next | awk -F"|" '{print($5)}'`
n=`echo $next | awk -F"|" '{print($6)}'`
o=`echo $next | awk -F"|" '{print($6)}'`
if grep -q "MO" $next
then echo "FOUND;" >> /home/scripts/sql.$E1.out
else echo "NOT FOUND;" >> /home/scripts/sql.$E1.out
fi
done
$E1.out files looks like :
40922|OPR MO 12345|OPR MO 12345|12345|202|local|LMNO