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:

count=0
while read line_by_line
do
file_name=$line_by_line
cd $file_name
echo "$PWD"
#whatsout > $FILE
#while read checkedout_file
#do
# 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

Report •

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

http://www.tek-tips.com/faqs.cfm?fi...



Report •
Related Solutions


Ask Question