while loop not looping with awk

March 18, 2010 at 20:35:00
Specs: Windows 7
I have an awk statement within a while loop but when I echo something, to see if it's looping it won't loop. I commented out the awk statement and it loops fine. I'm new to this and trying to teach myself how to write scripts. I know the awk statement is working fine because I'm redirecting the output into a file and the output is as expected. I'm using ksh and this is my while loop:

while read line_by_line
cd $file_name
echo "$PWD"
#whatsout > $FILE
#while read checkedout_file
# unchkout $checkedout_file
#done < $FILE

count=$(($count + 1))
echo $count
cd ..
echo "$PWD"
awk '{print substr($file_name,3)}' | awk -F\. '{print $1}' > FILE1
# uncheckout_file=awk '{print substr($line_by_line,3)}' | awk -F\. '{print $1}'

done < xxx

See More: while loop not looping with awk

March 19, 2010 at 07:38:01
Probably you are not embedding shell variable $file_name in awk properly. Check out this link:


Report •
Related Solutions

Ask Question