procedure iwc (infile) string infile {prompt="Input file"} int nlines {prompt="Number of lines in input file"} int nwords {prompt="Number of words in input file"} int nchars {prompt="Number of characters in input file"} # @(#) task iwc Author: R.A. Jansen -- Jan 18 1996 # @(#) # @(#) IRAF user interface for unix 'wc' command. Returns the number of # @(#) lines, words and characters in the input file as (integer) task # @(#) parameter values. # @(#) # @(#) BUGS: the behaviour of 'count' differs from 'wc' for binary files begin string cstr nlines = 0 nwords = 0 nchars = 0 if ( access("tmpiwc.out") ) { delete ("tmpiwc.out", yes, verify=no) } count (infile, > "tmpiwc.out") rdlist ("tmpiwc.out", 1, cline="INDEF") cstr = rdlist.cline nlines = int(substr(cstr,1,7)) nwords = int(substr(cstr,8,15)) nchars = int(substr(cstr,16,23)) delete ("tmpiwc.out", yes, verify=no) end