The file abc.txt
is a line sequential file where each record is having multiple fields. I than want to grep
two such fields from another line sequential file zzz.txt
and display for comparison.
To do so, I am using a for
loop i.e. for i in cat abc.txt
. I than want to cut
two different fields form the emerging string and want to grep
these substrings from a file.
Example script
for i in `cat abc.txt`
do
field1=`cut -c10-15 $i`
field2=`cut -c25-30 $i`
grep $field1 zzz.txt
grep $field2 zzz.txt
done
Problem
When I try doing it the error message shows the string and says that
cut: <string in $i>: No such file or directory
found.