subroutine get_nlines(kfile,stringp_file,nl) implicit none integer strlen,nl,ios character*100 kfile character*200 command character*100 stringp_file open(10,file=kfile(1:strlen(kfile)) & ,status='old',iostat=ios) if (ios.ne.0) then ! file not found nl=0 goto 123 endif c Number of lines in the specified data file command="wc -l < "//kfile(1:strlen(kfile))//" > "// & stringp_file(1:strlen(stringp_file)) call exec(command) open(10,file=stringp_file(1:strlen(stringp_file))) read(10,*) nl close(10) 123 continue return end