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

Testingtechniques And Strategy
Testingtechniques And StrategyTestingtechniques And Strategy
Testingtechniques And Strategy
nazeer pasha
 
Linux 101 Exploring Linux OS
Linux 101 Exploring Linux OSLinux 101 Exploring Linux OS
Linux 101 Exploring Linux OS
Rodel Barcenas
 

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

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
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
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

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