Emixa Mendix Meetup 11 April 2024 about Mendix Native development
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.