iwc (Aug2004) |
rjtools
|
iwc (Aug2004) |
iwc
iwc - return the number of lines, words and characters in a file as parameters
Simple task returning the number of lines, words and characters in input
(text) file 'infile' as integer valued task parameters. If the file
does not exist, an error message is printed to the standard output and
the number of lines, words and characters are returned as INDEF; if the
file exists but is empty, they are returned as 0.
1. Return the number of lines in a list of images and test that there is
no additional garbage in that list:
rj> iwc ("flat_V.lis") ; print (iwc.nlines)
7
rj> print (iwc.nlines == iwc.nwords)
yes
2. Test (in a script) to capture the case that a file is empty:
iwc (inlis)
if ( iwc.nlines == 0 ) error (1, "\""//inlis//"\" contains no data!")
The behavior of IRAF native task 'count' may differ from that of unix 'wc'
in the case of binary files.