Common symbols
~ Login User's current home directory
. Current directory
.. Top level directory of current directory
CD-Returns the last directory
; Command delimiter
# indicates a comment
? Wildcards represent any one character
* Wildcard denotes any character
$ Get Variable Contents
"and $ () are the results after the command is run
&& the relationships that are expressed and
|| A relationship that represents or
! Represents a non-relationship (find and awk represent inverse, the Linux command line represents history)
[] A wildcard indicates a range
The {} wildcard indicates that a sequence is generated
> Output Redirection (Overwrite)
>> Chasing heavier orientation
< input redirection
<< Append input Redirection
2> Error Input
Regular Expression Symbols
^a begins with a character
A$ End With a character
^$ Matching Blank lines
\ escape Character
. Point means match a single character
A * repeats a 0 or more times
. * Match All characters
^.* start with any character
. *$ End With any character
[ABC] matches a or B or C character
[^ABC] does not match the ABC character
[0-9] Matching numbers
[A-za-z] Match Letter
A{n,m} repeats the A-character N to M-Times
A{n} repeats the A character n times
A{n,} repeats a character at least n times
| Extends the regular expression, indicating or
+ Extended Regular expression that repeats one or more times
Extend regular expressions with egrep or GREP-E
[] differs from {}
[[email protected] ~]# echo test[0-9]
TEST[0-9]
[[email protected] ~]# echo test{0..9}
Test0 test1 test2 test3 test4 test5 test6 test7 test8 test9
[] means that there are multiple possibilities in a whole basket #或 @ or * regular expressions in the eye that the contents of the box (no matter how many kinds) are the same. Are all a basket, for example:
[Email protected] ~]# echo "###*****@@@@@#####[email protected]@@@######@@@@@@@2**@@@@****" |egrep "[#@*]+]
###*****@@@@@#####[email protected]@@@######@@@@@@@2**@@@@****
[Email protected] ~]# echo "###*****@@@@@#####[email protected]@@@######@@@@@@@2**@@@@****" |egrep-o "[#@*]+]
###*****@@@@@#####
@@@@######@@@@@@@
**@@@@****
[[email protected] ~]# echo "###*****@@@@@#####[email protected]@@@######@@@@@@@2**@@@@****" |awk-f "[#@*]+" ' {print $ }‘
1
Regular expression Practice files
[email protected] ~]# cat Test.txt
I am Oldboy teacher!
I Trach Linux.
I like Badminton Ball billiard ball and Chinese chess!
My blog is http://oldboy.blog.51cto.com
Our site is http://www.etiantian.com
My QQ number is 49000448.
Not 4900000048.
My God, I am not Oldbey, but oldboy!
[Email protected] ~]# ifconfig eth0|sed-rn ' s/^.*ddr: (. *) BCAS.*$/\1/GP ' #sed取IP地址
[[email protected] ~]# ifconfig eth0|awk-f "[:]+" ' nr==2 {print $4} ' #awk取IP地址
Summary of symbols in Linux