character, such as [a], a meets the requirements.[-]: range, such as [A-z], i.e. A, B, C to Z all meet the requirements.。 : all the individual characters.*: There are characters, the length can be 0.4.grep command uses a simple instance$ grep ' test ' d*Displays all rows that contain test in a file that begins with D.$ grep ' test ' AA bb ccDisplays the line tha
line to match regular expression.[]: A single character, such as [a], a meets the requirements.[-]: range, such as [A-z], i.e. A, B, C to Z all meet the requirements.。 : all the individual characters.*: There are characters, the length can be 0.4.grep command uses a simple instance$ grep ' test ' d*Displays all rows that contain test in a file that begins with D.$ grep
], a meets the requirements.[-]: range, such as [A-z], i.e. A, B, C to Z all meet the requirements.。 : all the individual characters.*: There are characters, the length can be 0.4.grep command uses a simple instance$ grep ' test ' d*Displays all rows that contain test in a file that begins with D.$ grep ' test ' AA bb ccDisplays the line that matches test in the
for each string. $ grep ' w\ (es\) T.*\1′aa If West is matched, es is stored in memory, labeled 1, and then searched for any character (. *) followed by another ES (\1), which is found to display the row. If you use Egrep or GREP-E, you do not have "\" number to escape, directly written as ' W (es) t.*\1′ on it. Example Two:grep commands use complex instances
Introduction to grep commands in AIX [plain] www.2cto.com grep three types of deformation 1. grep: Standard command, search for text, you can use a regular expression. 2. egrep: Extended grep. It supports basic and extended regular expressions, but does not support applicati
Ps and grep lookup eliminate grep self lookup and psgrep lookup eliminate
It is very convenient to use ps-def | grep to find the process. The last line will always grep itself.
$ Ps-def | grep dragonfly-frameworkdean 5273 5272 0 00:00:00 pts/5 newlisp. /dragonfly-framewo
Part I: Supplementary Umask Masking Code Directory permission is 777-umask User is 666-umask if the permissions of a certain class of users have execute permission, it will automatically add 1 The administrator's Mask code is 0022 for normal users for 0002 Part II: Text Processing tools 1. Definition: Linux files three local processing tools A:grep Text Filter tool, search tool b:sed File Editing tools C:awk Text Report Generator Grep:global Regular expression and printing shorthand Searches for
] ~]# grep-n ' go\{2,\}g ' Regular_express.txt18:google are the best tools for search Keyword.19:goooooogle yes!Extended grep (GREP-E or Egrep):The main benefit of using the extended grep is the addition of additional regular expression meta-character sets.Prints all rows th
Find file search commands in linux and grep file content search commands, grep Content Search
When using linux, you often need to find files. The search Commands include find and grep. The two commands are partitioned.
Differences(1) The find command is based onFile AttributesSearch, such as file name, file size, owner, group, whether it is empty, access time,
Brief Introduction
grep (Global search Regular expression (RE) and print out of the line, a comprehensive search for regular expressions and print out rows) is a powerful text search tool that uses regular expressions to search for text. and print out the matching rows.
The grep family of Unix includes grep, Egrep, an
] pattern [file...]Grep [Options] [-e pattern |-F file] [file...]
The grep command is used to search for the pattern specified by the pattern parameter and write each matching row to the standard output. These patterns are qualified regular expressions that use the Ed or egrep command style. If multiple names are specified in the file parameter, the
Grep command, grep command-
Grep -- search for strings matching rows in the file and Output
Command path:/bin/grep
Example 1:
# Grep Default/etc/inittab
Display the rows containing the Default string in the inittab file under the/etc/directory
Example 2: case insen
C: // progra ~ 1 // tugzip // tugzip.exe ???? Representative: C: // program files // tugzip // tugzip.exe
Answer:This is a normal phenomenon. It is due to the habit of the DOS operating system. In general, the file name in DOS is 8 characters long and 3 extension characters long.If the number is less than or equal to 8, the full name is displayed. However, if the number of file names is greater than 8 characters, only the first 6 are displayed, followed by a "~" Symbol,The number "1" indicates
be added before a specific character#grep ' \. ' DataFileOr#grep ' \ ' datafileTo query the file name controll.conf#grep ' controll\.conf '/path/to/some11. Query the format file nameFind six lowercase characters in a directory, followed by a period, followed by two uppercase and lowercase files#grep ' ^[a-z]\{1,6\}\.
We often use grep operations like Linux in database operations. The following solutions are available:
1. Run the MySQL operation in Linux and perform grep on it. However, this method cannot be used in MySQL.
$ Mysql-u me-P "use sometable; Describe tables;" | grep "user"
2. Use pager for filtering. pager is powerful and truly implements the
First, we will briefly introduce the regular expression Regular Expression (re) next time ). Grep (Global Search Regular Expression (re) and print out the line, full search for regular expressions and print out rows) is a powerful text search tool, it can use regular expressions to search for text and print matching rows. The grep family of UNIX includes grep,
. grep and Regular expressions
Grep–e "[a-z]+"
Or
Egrep "[a-z]+"
5. Output only the matching part, not the matching forward
The Echo is line. | Greip–o–e "[A-z]+\."
Output: Line
6. Print all rows except the line containing Match_pattern, using the
Grep-v Match_pattern File
7. Statistics text or file contains
:]]\{1,3\}. [[:d igit:]]\{1,3\}. [[:d igit:]]\{1,3\}. [[:d igit:]]\{1,3\}\b]-o10.1.70.102127.0.0.1192.168.122.12. Find out the maximum percentage value of partition space utilization[[email protected] ~]# df |tr-s ' |cut-d '-f5|egrep-o ' [0-9]{1,2} ' |sort-nr|head-1383, identify the user UID maximum user name, UID and shell type[[email protected] ~]# sort-nr-t:-k3/etc/passwd|head-1|cut-d:-f1,3,7nfsnobody:65534:/sbin/nologin4. Find out the permissions
1. grep Introduction
Grep (Global search Regular expression (RE) and print out of the line, a comprehensive search for regular expressions and print out rows) is a powerful text search tool that uses regular expressions to search for text. and print out the matching rows. The grep family of Unix includes grep,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.