Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How does Awk Handle Open Files? 1

Status
Not open for further replies.

goodmis1

Programmer
Feb 5, 2007
1
US
How does awk handle open files? Suppose I am running a cron job to find files that are downloaded to a directory via sftp. Every 10 minutes, I want to process the files using an awk script and move them to another directory. What would happen if the awk script was fired and the file was not finished downloading?

Would awk handle it gracefully or would I have to account for it in a unix script?

Thanks

Any assistance would be greatly appreciated

*/10 * * * * /bin/process_sun.sh > /dev/null 2>&1

for FILE in `find /home/Upload/* -prune -type f -newer TIMEFILE`
do
gawk -f convert_sunterra.awk $FILE
done
 
Why did you consider that the content of convert_sunterra.awk was out of interest ?
 
Would awk handle it gracefully or would I have to account for it in a unix script?
In my experience, it is far more likely that your script will process a 'partially' downloaded file. You might like to consider creating a 'lock' file just before the download starts and then deleting the 'lock' file when the download is complete.

I hope that helps.

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top