Announcement

Collapse
No announcement yet.

How To Search Multiple Words / String Pattern Using grep Command on Bash shell

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How To Search Multiple Words / String Pattern Using grep Command on Bash shell

    See https://www.cyberciti.biz/faq/search...ng-using-grep/
    Using Kubuntu Linux since March 23, 2007
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    #2
    That's a nice & quick tutorial.
    Back in 2009 and 2011 the CRU email leak took place. I used Kate and the following grep command to search all 1,072 emails for words and phrases:
    grep -B3 -A4 kill /home/jerry/Documents/IPCC stuff/FOIA_2009/FOIA/mail/*
    The "-B3" and "-A4" would print 3 lines before and 4 lines after the line that contained the match.

    I ran this using Kate. I had all 1,072 files listed in the left "Documents" panel, and had the Kate terminal panel open. I ran the grep command in the terminal panel. A listing of all the matches appeared in the terminal panel. If I clicked on the file name in the terminal panel that file was loaded into the text panel with the matched line in the center. From there I could copy&paste lines from the emails into a document I was writing about a selected topic. Kate and grep are powerful combinations.
    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
    – John F. Kennedy, February 26, 1962.

    Comment

    Working...
    X