SlideShare a Scribd company logo
1 of 11
A Powerful Text Search Utility:Grep Alibaba.com-Tech-QA-ICBU  Jay
Agenda  What’s Grep ? Howto use Grep ? How Grep solve our problems? And Grep for Windows ?? It’s SHOW time. Q &A
What’s Grep ? grep is a command line text search utility originally written for Unix.  An Acronym for: globalregular expressionprint 	global search regular expression(RE) and print out the line The grep command searches files or standard input globally for lines matching a given regular expression, and prints them to the program's standard output. variants of grep: egrep,fgrep
Usage of grep: Basic(1)  grep [options] PATTERN [FILE...] 	 grep [options] [-e PATTERN | -f FILE] [FILE...] Example1: grep error grepTest.txt  Example2: grep ERROR grepTest.txt case insensitive; using-i to ignore case e.g. :  grep -i error grepTest.txt
Usage of grep: Basic(2) Example3: grep  apple* grepTest.txt  Example4: grep  apple. grepTest.txt Example5: grep  apple /home/admin/* Example5: grep  -v apple grepTest.txt  -v, --invert-match Invert the sense of matching, to select non-matching lines.
Usage of grep: Basic(3) Example7: grep  apple* /home/admin -r Example8: grep search commons -r | grep search Example9:cat grepTest.txt | grep apple Example10: ps -ef | grepmyalibaba| grep -v grep  -R, -r, --recursive Read all files under each directory, recursively pipeline(|): the output of each process (stdout) feeds directly as input (stdin) to the next one
Usage of grep: regular expression Example1: grep "[Ee]xception" grepTest.txt  Example2: grep "^[a-z].*[1-9]" grepTest.txt  Example3: grep ".*com" grepTest.txt  Example4: grep "go3,5gle.*" grepTest.txt Just some examples; for more info, learn by yourselves.
How to solveourproblems ? Grep configuration fromourcommonantx.properties e.g.  grepbsscommons -r | grep port | grep -v .svn Grep process from ps command e.g.  ps -ef | grep charge1 | grep -v grep Grep some keywords from source code e.g. grep -i "companyId.*<.*0" ~/work/intl-site/  -r And others …
Grep for Windows Download: http://gnuwin32.sourceforge.net/packages/grep.htm Installation: As any other software for Win32 Usage: Add Grep’s bin-DIR to %PATH%;    Open the command line;(start--run--”cmd”) Use grep as a command line in linux This tool is a program of the GnuWin32 project.
SHOW Time
Q & A

More Related Content

Viewers also liked

Viewers also liked (18)

Linux intro 3 grep + Unix piping
Linux intro 3 grep + Unix pipingLinux intro 3 grep + Unix piping
Linux intro 3 grep + Unix piping
 
Sed & awk the dynamic duo
Sed & awk   the dynamic duoSed & awk   the dynamic duo
Sed & awk the dynamic duo
 
Unix
UnixUnix
Unix
 
Testingtechniques And Strategy
Testingtechniques And StrategyTestingtechniques And Strategy
Testingtechniques And Strategy
 
Advanced Shell Scripting
Advanced Shell ScriptingAdvanced Shell Scripting
Advanced Shell Scripting
 
Unix
UnixUnix
Unix
 
Unix day3 v1.3
Unix day3 v1.3Unix day3 v1.3
Unix day3 v1.3
 
What Linux is what you should also have on your computer.
What Linux is what you should also have on your computer.What Linux is what you should also have on your computer.
What Linux is what you should also have on your computer.
 
Linux 101 Exploring Linux OS
Linux 101 Exploring Linux OSLinux 101 Exploring Linux OS
Linux 101 Exploring Linux OS
 
Unix day2 v1.3
Unix day2 v1.3Unix day2 v1.3
Unix day2 v1.3
 
Awk Unix Utility Explained
Awk Unix Utility ExplainedAwk Unix Utility Explained
Awk Unix Utility Explained
 
Unix day4 v1.3
Unix day4 v1.3Unix day4 v1.3
Unix day4 v1.3
 
7th sem it_CSVTU
7th sem it_CSVTU7th sem it_CSVTU
7th sem it_CSVTU
 
Awk essentials
Awk essentialsAwk essentials
Awk essentials
 
unix crontab basics
unix crontab basicsunix crontab basics
unix crontab basics
 
Presentation of awk
Presentation of awkPresentation of awk
Presentation of awk
 
Sed Unix Utility Explained
Sed Unix Utility ExplainedSed Unix Utility Explained
Sed Unix Utility Explained
 
Shell script-sec
Shell script-secShell script-sec
Shell script-sec
 

Recently uploaded

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 

Recently uploaded (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Grep: A Powerful Text Search Utility

  • 1. A Powerful Text Search Utility:Grep Alibaba.com-Tech-QA-ICBU Jay
  • 2. Agenda What’s Grep ? Howto use Grep ? How Grep solve our problems? And Grep for Windows ?? It’s SHOW time. Q &A
  • 3. What’s Grep ? grep is a command line text search utility originally written for Unix. An Acronym for: globalregular expressionprint global search regular expression(RE) and print out the line The grep command searches files or standard input globally for lines matching a given regular expression, and prints them to the program's standard output. variants of grep: egrep,fgrep
  • 4. Usage of grep: Basic(1) grep [options] PATTERN [FILE...] grep [options] [-e PATTERN | -f FILE] [FILE...] Example1: grep error grepTest.txt Example2: grep ERROR grepTest.txt case insensitive; using-i to ignore case e.g. : grep -i error grepTest.txt
  • 5. Usage of grep: Basic(2) Example3: grep apple* grepTest.txt Example4: grep apple. grepTest.txt Example5: grep apple /home/admin/* Example5: grep -v apple grepTest.txt -v, --invert-match Invert the sense of matching, to select non-matching lines.
  • 6. Usage of grep: Basic(3) Example7: grep apple* /home/admin -r Example8: grep search commons -r | grep search Example9:cat grepTest.txt | grep apple Example10: ps -ef | grepmyalibaba| grep -v grep -R, -r, --recursive Read all files under each directory, recursively pipeline(|): the output of each process (stdout) feeds directly as input (stdin) to the next one
  • 7. Usage of grep: regular expression Example1: grep "[Ee]xception" grepTest.txt Example2: grep "^[a-z].*[1-9]" grepTest.txt Example3: grep ".*com" grepTest.txt Example4: grep "go3,5gle.*" grepTest.txt Just some examples; for more info, learn by yourselves.
  • 8. How to solveourproblems ? Grep configuration fromourcommonantx.properties e.g. grepbsscommons -r | grep port | grep -v .svn Grep process from ps command e.g. ps -ef | grep charge1 | grep -v grep Grep some keywords from source code e.g. grep -i "companyId.*<.*0" ~/work/intl-site/ -r And others …
  • 9. Grep for Windows Download: http://gnuwin32.sourceforge.net/packages/grep.htm Installation: As any other software for Win32 Usage: Add Grep’s bin-DIR to %PATH%; Open the command line;(start--run--”cmd”) Use grep as a command line in linux This tool is a program of the GnuWin32 project.
  • 11. Q & A