---------hello--------------
-----------------hai----------
-------------hello------------
-----HELLO---------------
---------hai------------------
$ grep “hello” file1 file2 file3
File1:---------hello--------------
File1:-----------------hai----------
File2:-------------hello------------
File3:---------hai------------------
$ grep “hello” *.dat
To search for hello pattern in all .dat files
Use case for grep command Grep is used to segregate (categorization) of data
Requirement To get all sales dept records and store into one file
$ grep “sales” emp.dat > sales.dat
To get clerks information working under sales dept
$ grep “sales” emp.dat | grep “clerk” > clerk.dat