remove blank rows and rows whose first line is #, we will use the following:Woody @ xiaoc :~ /Tmp $ grep-V '^ $ 'regular_express.txt | grep-V' ^ #'"Open Source" is a good mechanic to develop programs.Apple is my favorite food.Football game is not use feet only.This dress doesn' t fit me.............
However, it is much easier to use egrep and extended special sy
, does not match A;[Email protected] ~]# grep-e "Go+d" test1My god,i am not oldbey,but OldboyGoodGoood(2)? : Match the previous 0 or 1 times---ab? Indicates matching A or AB, does not match ABB;[Email protected] ~]# grep-e "Go?d" test1My god,i am not oldbey,but OldboyGd(3) | : Match any of the---ab|cd to match ab or CD;[Email protected] ~]# grep-e "God|good" test
used for research useClass A: First paragraph of IP from 1-127Class B: First paragraph of IP from 127-191Class C: The first segment of IP from 192-223There are three grep commands, except grep, Egrep, and a fgrep commandgrep only supports commands for basic regular expressions by defaultEgrep is a command that supports extended regular expressionsFgrep = Fast
Source" is a good mechanic to develop programs.Apple is my favorite food.Football game is not use feet only.This dress doesn' t fit me.............
However, it is much easier to use egrep and extended special symbols that support extended regular expressions.Note that grep only supports basic expressions, while egrep supports extensions. In fact,
The Linux egrep command is used to find the specified string within a file.Egrep execution effect is similar to "GREP-E", the syntax and parameters used can refer to the GREP directive, and the difference between grep is the method of interpreting the string.Egrep is interpreted with extended regular expression syntax,
Egrep
Feature Description: The Egrep command is the same as the grep command with the-e flag, except that the error message and the use message are different and the S-flag function is different. To search for one or more files using the Egrep command, the prompt can be an extension of the rule expression symbol. Exte
Linux grep and regular expression, grep Regular ExpressionGrep Introduction
Grep is a powerful text search tool that uses regular expressions to search for text and print matching rows. Generally, grep has three versions: grep, egrep
, but add the escape symbol \ in the extended regular expression \.
Other options in the extended regular expression:
\ S: matches blank characters
\ S: Match non-blank characters
\ W: matching letters and numbers, equivalent to [0-9a-zA-Z]
\ W: unmatched letters and numbers, equivalent to [^ 0-9a-za-z]
4. Other grep options
Grep pattern file-a num: After grep
1 download: http://www.vim.org/scripts/script.php? Script_id = 1, 3112. decompress the grep. Vim file to the/usr/share/Vim/vim70/plugin folder.3. Help: In the grep. Vim File Header4 usage:The following describes its usage:Vim has its own search function, but it is still a little different from the grep in shell. Sometimes when coding is in a rush, I really want t
Grep and grep commands
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. Unix grep families include
Mode: patternRegular:grep: Basic RegularExtended grep: Extending the regularBasic Regular:. : Any single character[]: Within the specified range[^]: outside the specified rangeNumber of Matches*: Characters appear any time?: Characters appear 0 or 1 times\{m,n\}: Characters appear at least m times, at most n times\{1,\}: Characters appear at least 1 times. *: Matches any character of any lengthAnchoring:^: Anchoring the beginning of the line$: Anchor
Tags: EGREP LINUX extended Regular expressionEgrep An extended regular expression implementation is similar to the grep text filtering feature: Grep-e grep [OPTIONS] PATTERN [FILE ...] grep [OPTIONS] [-E PATTERN |-f file] [FILE ...] Options:--color=auto: Shading The mat
Egrep: Use an extended regular expression to build the pattern, which is equivalent to GREP-E Meta characters : Character Matching :. : Any single character []: Specify any single character in the range [^]: Any single character outside the specified range number of matches : *: Matches its preceding character any time ?: Match its preceding character 0 or 1 times+
Today, my master gave me a few regular exercise questions. I didn't get them out for a long time. I was frustrated by my self-confidence, and my character broke out. I copied some data that conforms to and does not comply with the rules to the Linux notepad and saved it for query. Oh, too, okay, I thought it was code.
If you use egrep to search for regular text data in a file, be sure to check whether your file encoding is correct. In particular, i
Grep command, grep command
Grep is one of the most widely used commands in UNIX and LINUX. Grep allows mode searches for text files. If the matching mode is found, grep prints all rows containing the mode. Grep supports basic regu
Extending regular ExpressionsExtended Regular Expression command: EgrepRegular expressions are not supported but fast: fgrepCharacter Matching:.:[]:[^]:Number of matches:*:?:+: Match the characters in front of it at least once{m}: Exact match{M,n} no backslash required:Location anchoring:^:$:\\> or \b:Group:(): Group\1,\2,\3,......Or|: or (A|B)Cases:C|cat=c or Cat(c|c) At=cat or catLazy Qualifier*? Repeat any number of times, but repeat as little as possible+? Repeat 1 or more times, but repeat
Common grep usage and grep usageGrep Introduction
As described in the linux man file:
Grep searches the named input FILEs (or standard input if no files are named, or if a single hyphen-minus (-) is given as file name) for lines containing a match to the given PATTERN. by default, grep prints the matching lines.In ad
The normal expression of grep is divided into basic REGEXP-Regular expressionsExtended REGEXP extending a regular-rule expressionGrep-a 2 indicates that the following two lines of the matched character are also displayedGrep-b 2 indicates that the first two lines of the matched character are also displayedGrep-c 2 indicates that both front and back lines of the matched character are displayedCharacter matching. Represents any one character[] denotes a
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.