home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.os.linux.ubuntu      I preferred Xubuntu, seemed a bit faster      134,474 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 134,238 of 134,474   
   Paul to Adam   
   Re: how to grep for pattern1 AND pattern   
   13 Mar 25 15:16:01   
   
   From: nospam@needed.invalid   
      
   On Thu, 3/13/2025 2:17 PM, Adam wrote:   
   >   
   > The following ...   
   >   
   > grep -e pattern1 -e pattern2 wget_output_file.txt   
   >   
   > is NOT giving the result that I'm looking for, which is BOTH patterns must   
   be in the file.   
      
   "The egrep variant supports an extended regular expression syntax added by   
   Alfred Aho   
    after Ken Thompson's original regular expression implementation.[12]   
      
    The "fgrep" variant searches for any of a list of fixed strings using   
    the Aho–Corasick string matching algorithm."   
      
   *******   
      
   sample.txt   
   ----------   
   I am a cat   
   I am a dog   
   I am a cat or a dog   
   I am an elephant   
      
   (stdout)   
      
   $ egrep "cat|dog" sample.txt   
   I am a cat   
   I am a dog   
   I am a cat or a dog   
      
   "If at first you don't grep, try try again... with a egrep or a fgrep" :-)   
      
   It's a good thing these are documented.   
      
       Paul   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca