The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
On Premature Optimization iBot Complex Event Processing RSS News 0 02-12-2008 02:20 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 12-26-2005
Registered User
 

Join Date: Sep 2004
Location: Mumbai-India
Posts: 151
Premature EOF

How to check for a premature EOF in a regular file in a shell/perl script?
I want to check if I have received a complete file or not.

Thanks,
Rahul.
Reply With Quote
Forum Sponsor
  #2  
Old 12-26-2005
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,683
Why not use checksum ?
Reply With Quote
  #3  
Old 12-26-2005
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,609
here is one more,

have a trailer record for each of the file you are receiving
(just including a single line is not going to affect the receiving file size)
trailer record to contain no of records in the file

existence of trailer indicates complete file transfer
Reply With Quote
  #4  
Old 12-30-2005
Registered User
 

Join Date: Sep 2004
Location: Mumbai-India
Posts: 151
But How?

Vino,

How to use checksum? When i type checksum on my command prompt, it says command not found. I am using a Sun Solaris 5.8

Madhan,

I am using wget to grab the webpage running on Windows server. What the following command does is create a file with the webpage URL name in my current directory.

wget -nv -o /tmp/wget.csv.log -t 5 -w 10 http://vpcmsa06/qos/1HRScsv.asp

Now, Without doing any modification to this file i.e http://vpcmsa06/qos/1HRScsv.asp, I want to check if it has a premature EOF.

Any advise would be helpful.

Thanks,
Rahul.
Reply With Quote
  #5  
Old 12-30-2005
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,609
i understand that the modification to the existing asp file would not be possible

instead, is it possible to idenitfy the start and end of the file with markers
just as we do in html pages ?

(ex only)
<HTML>
</HTML>

but i am not sure how far this could be made use of ....
its just an example or kind of way proceeding with that.
Reply With Quote
  #6  
Old 12-30-2005
Registered User
 

Join Date: Sep 2004
Location: Mumbai-India
Posts: 151
No Specific Markers

These files will not have any specific start or end markers and hence I am unable to do a premature EOF check.

Thanks,
Rahul.
Reply With Quote
  #7  
Old 12-30-2005
linuxpenguin's Avatar
Registered User
 

Join Date: May 2002
Location: India
Posts: 295
I will still stick to Vino. If you have a way to get the checksums of the file from the place where you are getting it, then you can run the command cksum on the received file, and then match the two. cksum is one of the surest way to convince that the file received is complete and exactly the same as one that is sent.
__________________
War doesnt determine who is right, it determines who is left
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:37 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0