grep command GREP command

ls -l | grep -i python  # -i  = case insensitive search

ls -l | grep -v "python"   # -v = invert the search , not matching element will be printed

# find . –name "*.mp3" | grep –i JayZ | grep –vi "remix" 

ps -ef | grep -c [h]ttpd  #count number of matching line

cat myfile.txt | grep -n "major12"  # print line number of matching line

cat myfile.txt | grep -w "NepalKTM"  #returns only "NepalKTM" match entire word only
 
cat apache.conf | grep -v "^#"  

No comments:

Post a Comment