Sunday, 28 February 2021

LINUX - HOW TO USE GREP COMMAND TO SEARCH IN LINUX

LINUX - HOW TO USE GREP COMMAND TO SEARCH IN LINUX
 
The command is as follows:-
 

Command :- cat sorted1.txt | grep mike

 

 In the above example we used the output of the command cat and piped | it with grep to find mike in the text file sorted1.txt

 In the below screenshot, we tried to use the output of the command ls -al to search the directory mike on the current location.

 Now we can use the command grep to search in the below way as well

 

In the below example, we want to search net in the file test1.log


No comments:

Post a comment