5 Grep Tools for Linux By Ivana Isadora Devcic – Posted on Mar 1, 2015 Mar 1, 2015 in Linux As every Linux user surely knows, grep is a reliable command-line tool for in-depth file searching. To quickly find any text string within any text file, try this from a terminal window: grep -l [text to find] [files to look in] For example, grep -l 123abc *.html will list the name of any file in the current directory that ends in.html and contains the string 123abc.
I have a log file with entries like the following:
Input
Output
What I'm trying to do is match all lines from a log file unless - it contains php
followed by error
or notice
. If it contains php
followed by error
or notice
, then it should only match if winner
is also in the string. My regex-foo is weak. Thanks.
2 Answers
Use this: grep 'phps+(error|notice).*winner' mylogfile
There might be a way to get grep to pull that off in one string but I think personally I'd make it script to handle that in either perl or bash.In bash it would be something like
I don't have a system handy to test/debug this right now, so you may have to tweak it a bit.
Not the answer you're looking for? Browse other questions tagged grepregexgnu or ask your own question.
Log Analyzer Tool
Top 4 Download periodically updates software information of windows grep full versions from the publishers, but some information may be slightly out-of-date.
Grep Regex Replace
Using warez version, crack, warez passwords, patches, serial numbers, registration codes, key generator, pirate key, keymaker or keygen for windows grep license key is illegal. Download links are directly from our mirrors or publisher's website, windows grep torrent files or shared files from free file sharing and free upload services, including Rapidshare, MegaUpload, YouSendIt, Letitbit, DropSend, MediaMax, HellShare, HotFile, FileServe, LeapFile, MyOtherDrive or MediaFire, are not allowed!
Your computer will be at risk getting infected with spyware, adware, viruses, worms, trojan horses, dialers, etc while you are searching and browsing these illegal sites which distribute a so called keygen, key generator, pirate key, serial number, warez full version or crack for windows grep. These infections might corrupt your computer installation or breach your privacy. windows grep keygen or key generator might contain a trojan horse opening a backdoor on your computer.