In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Need for text lookup:
Grep,egrep,fgrep
Grep: search for text based on the pattern and display lines of text that match the pattern.
Pattern: a matching condition formed by the combination of text characters and metacharacters of regular expressions
Grep [OPTIONS] PATTERN [FILE...]
-I: ignore case
-- color: match highlight color
-v: displays lines that have not been matched
-o: only the strings matched by the pattern are displayed
Regular expressions: GEGular,EXPression,REGEXP
Metacharacters:
.: match any single character
Number of matches:
*: match the characters before them any number of times
[]: matches any single character in the specified range
[^]: matches any single character outside the specified range
[: digit:], [: lower:], [: upper:], [: punct:], [: space:], [: alpha:], [: alnum:] this is a collection of characters
Add double parentheses when using, for example: [: digit:]
A,b,ab,aab,acb,adb,amnb
Axib
[root@one ~] # grep ahumb test.txt
B
Ab
Aab
Acb
Adb
Amnb
A. Roomb
[root@one ~] # grep 'a.roomb' test.txt
Ab
Aab
Acb
Adb
Amnb
\?: match the character in front of it 1 or 0 times
[root@one] # grep'a\? B 'test.txt
B
Ab
Aab
Acb
Adb
Amnb
\ {mdirection n\}: match the characters before them at least m times and n times at most
\ {1,\} at least once, no limit
\ {0pr 3\} 3 times at most
[root@one ~] # grep'a\ {1Jing 3\} b'test.txt
Ab
Aab
Position Anchor:
^: anchor the beginning of the line, and anything after this character must appear at the beginning of the line
[root@one ~] # grep'^ r.. t'/ etc/passwd
Root:x:0:0:root:/root:/bin/bash
$: anchors the end of the line, and anything before the secondary character must appear at the end of the line
[root@one ~] # grep'b.. hackers'/ etc/passwd
Root:x:0:0:root:/root:/bin/bash
Vagrant:x:500:500:vagrant:/home/vagrant:/bin/bash
Tom:x:501:501::/home/tom:/bin/bash
User3:x:2002:1002:User3,be,110,119:/home/user3:/bin/bash
User4:x:1003:1003:Tony Blare:/home/blare:/bin/bash
User7:x:1006:1006::/home/user7:/bin/bash
Apache:x:497:497::/home/apache:/bin/bash
Hadoop:x:2003:2003::/home/hadoop:/bin/bash
^ $: blank line
Any character in front of it must appear at the end of the word
\ b put before or after a word to indicate an anchor prefix or suffix
Grouping:
\ (\)
\ (ab\) *
Latter item reference
\ 1: reference everything contained in the first left parenthesis and the corresponding closing parenthesis.
\ 2:
\ 3:
He love his lover.
She like her liker.
He like his lover.
[root@one ~] # grep'\ (ab\) * 'test.txt
A
B
Ab
Aab
Acb
Adb
Amnb
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.