Skip to main content

12.2) Searching


Let’s consider an example using the files that we have ‘file1’ and ‘file2’. If you want to see if file ‘file1’ has the value of ‘0.43’ in it then type:

grep ‘0.43’ file1

This file ‘file1’ has the value in column 2 and row 2. If you want to check file ‘file2’ for the ‘0.43’ value then type:

grep ‘0.43’ file2

If you want to look inside all files that begin with word ‘file’ (maybe you might have a lot of files, ‘file1’, ‘file2’, ‘file3’, ‘file4’, etc) for the ‘0.43’ value then type:

grep ‘0.43’ file*

Note that if you issue a command and the Unix system doesn't respond then as a response to stop the command you can hold down the 'Ctrl' button and type 'c' at the same time. This will stop most commands and return you to Unix again.