10-12-2004
8,
0
Join Date: Oct 2004
Last Activity: 9 November 2004, 10:00 AM EST
Posts: 8
Thanks Given: 0
Thanked 0 Times in 0 Posts
awk script
I am trying to get awk to search a file called $filetoDownload
check for matching files and place them in palocal_check/dirs.txt
it will them cut out the first 10 fields and place them in
dirsfound.txt
The code as it looks now is as follows:#get the factset file
filetoDownload=`echo $acct | awk -F',' '{print $1}'`
#get the xls file to download
XlsfiletoDownload=`echo $acct | awk -F',' '{print $1}'`
filetoDownload=`echo $acct | awk -F',' '{print $2}'`
filetoDownload=`echo $filetoDownload | awk -F'_' '{print $1"_"$2"_"$3"_"$4}'`
printLog "searching for ${filetoDownload}"
##awk -F, '/'$filetoDownload'/ {print $2}' $palocal_check/dirs.txt > $palocal_check/dirsfound.txt
##cut -d "/" -f2-10 $palocal_check/dirs.txt > $palocal_check/dirsfound.txt
awk -F, '/'$filetoDownload'/ {print $1"/"$2"/"$3"/"$4"/"$5}' $palocal_check/dirs.txt > $palocal_check/dirsfound.txt
cat $palocal_check/dirsfound.txt
DirectoryFound=`cat $palocal_check/dirsfound.txt`
#did we get a match