Currently I can do it using something like cut -d"|" -f1, but when I put that into a while loop (need to go through the text file line by line), it stops working.
Here is the code I have now:
while read line
do
O1=`cut -d '|' -f1 $line`
O2=`cut -d"|" -f2 $line`
"
"
O8=`cut -d"|" -f8 $line`
echo "Field O1 is $O1"
echo "O2 is \n$O2"
"
"
echo "O8 is \n$O8"
done < listing.txt
I'm wondering if it is the presence of the pipe character which is confusing the shell.
I'm willing to try any alternative approach people can suggest. I know this should be simple, but I just can't get it to work.