/wKioL1RyBW6gyoowAAENihiIgQE185.jpg "alt=" Wkiol1rybw6gyoowaaenihiigqe185.jpg "/>5. Find one or two digits in the/etc/passwd file;650) this.width=650; "title=" QQ picture 20141123222739.png "style=" Float:none; "src=" http://s3.51cto.com/wyfs02/M01/53/D7 /wkiom1rybplhrb48aamxu-qfgas665.jpg "alt=" Wkiom1rybplhrb48aamxu-qfgas665.jpg "/>6, displays the line that starts with at least one whitespace character in/boot/grub/grub.conf;650) this.width=650; "Width=" 857 "height=" 131 "title=" QQ picture 2
1. grep Introduction
Grep (Global Search regular expression_r (re) and print out the line, fully search for regular expressions and print rows) is a powerful text search tool, it can use regular expressions to search for text and print matching rows. UNIX grep families include grep,
[Familiar with Linux] grep \ egrep \ fgrep and regular expression of the text processing tool, egrepfgrep
It is often said that there are three swordsmen for text processing on Linux, grep, sed, and awk. This article gives a detailed description of grep and introduces a regular expression.
that are matched during a specific match, can be memorized by grep (stored in the built-in variables, these variables are \1,\2,... ), so that it can also be referenced\1: Reference, from left to right in a pattern, matched by the first opening parenthesis and the pattern in the right parenthesis corresponding to it\2: Reference, from left to right in a pattern, matched by the second opening parenthesis and the pattern in the right parenthesis corres
A: A brief introduction to grep and Egrep :grep and Egrep are more of a tool for Linux text Search in Linux. It combines regular expressions to implement rows that match the model.Two: syntax format :grep [option] ... ' PATTERN ' FILE ... Support for basic regular expressio
, which means gd and good(): Find the group string(): grouping, the pattern in parentheses matches to the content, and remains in the intrinsic variable,\1: from the left, the first opening parenthesis, and the pattern that matches the middle of the right parenthesis to match the content\2: from the left, the 2 opening parenthesis, and the pattern that matches the middle of the right parenthesis paired to the content ()+: Judgment of multiple groupsI suggest you use alias to write
Grep, egrep, and fgrep for basic regular expressions and text processing tools
Grep (Global Search Regular Expression and print out the line global search Regular Expression and print out the rows) is a powerful text search tool, the commands of egrep and fgrep are only slightly different from those of
Linux basic command grep egrep fgrep usage and regular expression 1. grep, egrep, and fgrep commands this article mainly introduces the basic parameters and usage formats of grep egrep fgrep commands and regular expressions in lin
Tags: class number highlighting Roo postfix understanding direct. com LoginI. OverviewRegular expressions are the knowledge that is often needed in operational operations. File lookups, log parsing, rewrite rules, shell scripts, and so on, all require the knowledge of regular expressions. So what is a regular expression? My understanding is to find or replace the string you need according to certain rules, which is a regular expression, exactly, it is a rule. There are many commands to use regul
"Reprinted from" http://blog.csdn.net/homking/article/details/6000711
Egrep equivalent to Grep-e
Fgrep equivalent to Grep-f
GREP-E xxx-e yyy can specify multiple conditions and can contain-
Grep-a 3 print matching line and match line first 3 lines
Detailed description of grep, egrep, and fgrep usage of text search commands
I. Learning Objectives
Understand and be familiar with grep, egrep, and fgrep commands.
Ii. Learning Content
1. Meaning and usage format of grep, egrep,
/meminfo
For example, if the default shell is not bash
# Grep-V "bash $"/etc/passwd | cut-D:-F1
For example, retrieve the user whose default shell is Bash and whose ID is the largest
# Grep "bash $"/etc/passwd | sort-n-t:-K3 | tail-1 | cut-D:-F1
For example, the/etc/rc. d/rc. sysinit file starts with #, followed by at least one blank character, and then contains at least one non-blank line.
#
' # ' grep-v ' ^# ' 1.txtRemove all empty lines and lines beginning with ' # ' grep-v ' ^$ ' 1.txt|grep-v ' ^# 'filter out lines that begin with the English alphabet grep ' ^[a-za-z] ' 1.txtfilter out lines that start with a non-digit grep ' ^[^0-9] ' 1.txtfilter any one or
1.1, the basic definition: www.2cto.comgrep (Global search regular RE) and print out of the line, full search of regular expressions and print out the lines, is a powerful text search tool that can only use basic regular expressions to search for text and print matching lines.grep is a common and commonly used command, and its main function is to compare string data and then print out strings that match the user's needs, but the idea is that when grep
, ...Features that increase compared to basic regular expressions| : ORA|b: Indicates a or bC|cat: Indicates C or cat(C|C) at: Indicates Cat or catUsing the example650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7D/04/wKiom1bedyriKT60AAArB_vE_Ds116.png "title=" Grep23.png "alt=" Wkiom1bedyrikt60aaarb_ve_ds116.png "/>Egrep: Support for grep commands using extended regular expressions, equivalent t
grep (Global search regular RE) is a powerful text search tool that only uses basic regular expressions to search for text and prints matching lines.grep is a common and commonly used command, and its main function is to compare string data and then print out strings that match the user's needs, but the idea is that when grep looks for a string in the data, the data is filtered in the "Whole row" unit.Examp
Grep nobody/etc/passwd display rows with nobody characters in/etc/passwd, case sensitive
Grep-I nobody/etc/passwd real-world/etc/passwd rows with nobody characters, case insensitive
Grep-V nobody/etc/passwd rows that do not contain the nobody
Grep-N nobody/etc/passwd: displays the row containing the nobody and the r
;
# Cut-D:-F7/etc/passwd | sort-u
2. Extended Regular Expression
Egrep: uses an extended regular expression to construct the mode, which is equivalent to grep-e.
Character match:
.: Any single character
[]: Any single character in the specified range
[^]: Any single character out of the specified range
Matching times:
*: Match any character before it;
? : Match the first character 0 or 1 time;
+: Match th
An expression
Meaning
C
Any non-special character c that matches itself
\c
Remove any special meaning of character C
^
Header
$
End of Line
.
Any single character
[...]
... Any character in a character, a range like a-Z is legal
[^...]
Not... Any single character in the
\ n
Characters matching the nth \ (... \) (in
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.