The following grep- based regular; for awk and sed Much the same, a small part is different:
regular expressions are used to quickly filter and replace some specific strings in a unit of behavior Regular expressions are case-sensitive and areGreptime can be added- I.Case insensitive . .represents and can only be any one character, such as the letter in the file name is.can also represent a hidden file,you can also indicate that all rows are filtered asgrep-n. Nginx. Conf-nindicates the line number before each line is filtered. In regular expressions.*does not mean the match all, actually represents duplicates0One or more of the preceding characters, such as filtering2300056, you can usegrep"230*56" can match 2356 23056 230056 2300056 23000..56
. * matches all characters ^.* starts with any character. [] means match any one of the characters. [^] denotes any character content other than [] , not a matching line.
the following if use egrep can remove \ Line
a\{n,m\} repeats n to m times, before a repeating character.
\{n,\} repeats at least n times, preceding a repeating character.
\{n\} repeats n times, before a repeating character.
an extended regular expression: Ere
+ Repeat one or more of the preceding characters with egrep or grep-e
? of 0 or 1 a preceding character
| find multiple matching strings in a way or
() Find the user group string
Enterprise interview: Remove network card Ip
Ifconfig eth0 |sed-n ' /inet addr/ ' |cut-d ' : ' -f2 |cut-d ' ' -f1 or use
Ifconfig eth0 |grep'inet Addr'|awk-f'[: ]+' '{print $4}'+ means match more than any character here represents a space before matching inet for multiple spaces. Simple Direct awk {nr==2} when a line number is in awk
^.*addr: Begins with any character addr: End bc.*$ begins with Bc with any character ending
following Sed
' s#^.*addr:\ (. *\) bca.*$#\1#g ' p remove the front parenthesis ( .*\ ADDR ip sed take out what you need in a row
Linux Regular expressions