function n_lines,file,nw ;+ ; ROUTINE: n_lines ; ; PURPOSE: count number of lines in a file ; ; USEAGE: result=numlines(file,nw) ; ; INPUT: ; file file name ; ; OUTPUT: ; result number of lines in file ; nw number of words in file ; ; EXAMPLE: ; ; file='/local/idl/user_contrib/esrg/n_lines.pro ; print,'number of lines =',n_lines(file,nw) ,$ ; 'number of words =',nw ; ; AUTHOR: Paul Ricchiazzi 29 Feb 96 ; Institute for Computational Earth System Science ; University of California, Santa Barbara ; paul@icess.ucsb.edu ; ; REVISIONS: ; ;- ; spawn,['wc',file],result,/noshell nl=0L nw=0L if result(0) ne '' then reads,result,nl,nw return,nl end