The Grep Command

Grep is used as search command

Example :

grep "emaad" filename.txt
grep ifconfig enpo164464245 | grep "inet"

Grep "West" *
Will search West in all the files in current directory


man grep        ------------------ to pull up the manual page
q - to go back from manual screen


Grep "West" * -R  -> this will search recursively from in all the directories


Redirection with Grep : 

Grep -i "west" * > File1.txt


-i is for case insensitive
Result will be stored in File1,txt

Sort Command: 

Grep -i "west" emaad.txt | sort -k 2  (Colums 2)



Grep -i "^north" emaad.txt  ----------return lines begin with north
Grep -i "north$" emaad.txt  ----------return lines ends with north



Comments

Popular posts from this blog

SNMP Configuration on Brocade Switches

Netapp Clustered Ontap CLI Pocket Guide

Netapp 7-Mode Architecture