Submit a Story  :  IRAF Links  :  Past Polls  :  Calendar  :  Advanced Search  
     iraf.net
FAQ
 Forum FAQForum FAQ   Forum SearchForum Search   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

script cl issue

 
Post new topic   Reply to topic    iraf.net Forum Index -> General IRAF
View previous topic :: View next topic  
Author Message
Chuck Horst



Joined: 17 Apr 2010
Posts: 3

PostPosted: Thu Jan 05, 2012 8:37 am    Post subject: script cl issue Reply with quote

I am looking for a way to test if a file is empty or not in a script. I see access to see if a file exists. What would be a good way to tell if it is empty. The returned value would be used to test.

Thanks...chuck
Back to top
View user's profile Send private message
fitz
Site Admin


Joined: 30 Sep 2005
Posts: 3256
Location: Tucson

PostPosted: Thu Jan 05, 2012 4:29 pm    Post subject: Reply with quote

See the COUNT task (similar to unix 'wc'), e.g.

Code:


count ("/dev/null") | scan (nlines, nwords, nchars, fname)
if (nchars == 0) {
    # file is empty ....
}

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    iraf.net Forum Index -> General IRAF All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2009 phpBB Group
 Copyright © 2005-2011 iraf.net
 All trademarks and copyrights on this page are owned by their respective owners.
Powered By Geeklog 
Created this page in 0.49 seconds