Skip to main content

12.6) Examples (cont'd)


Say I want to look at all the input files and see now many processors were used in each input file then I can type:

grep ‘NPES’ *

This will print the names of files that have ‘NPES’ written in them and it will print the line that ‘NPES’ appears on, so I can see the values that each file of ‘NPES’ takes.

If I want to find all files that use 800 locations in the horizontal then I can type:

grep ‘JJP=800’ *

If I just want to look at the value of ‘JJP’ in one file called ‘inputfile1’ then type:

grep ‘JJP’ inputfile1

The result will be the printing of the line that matches the search of ‘JJP’. i.e.

      INTEGER, PARAMETER :: JJP=800   ! Number of grid points in y-direction

Note, that if the file had hundreds of matches of your search pattern then grep will show every line and they will appear on your screen and fill up your screen and then more can be used to show you a page full at a time.