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

I would like to search a file called $filetodownload , print the first

five fields after the "/" , compare this file to another file called

$palocal_check/dirsfound.txt and redirect the output of the

common files to $palocal_check/dirsfound.txt

Is there any way of doing this in AWK ? or if not any other way

Posting the same question twice isn't going to get you a speedier response!

Merged different threads. chambala5, use post reply instead of new thread button.

How do you compare two files in awk