Find-type: Search by file type
-name: Search by file name
! Take counter
SED command combat:
Sed-n "2p" oldboy.txt print the second line
Sed-n "1,2p" Oldboy.txt print line first to second
Replace DDD with Oldboy print: sed ' s#ddd#oldboy#g ' oldboy.txt
Change the content ddd to Oldboy and print: Sed-i ' s#ddd#oldboy#g ' oldboy.txt
Basic Regular Expressions: Some special symbols represent some special functions and functional definitions.
Sed-i ' s# (regular match available) #\1#g ' Oldboy.txt
. Single arbitrary character
* Repeat any of the preceding 0 or more characters
. * matches any character
Enclose the result in parentheses in the preceding regular match, followed by a \1 representation.
$ A indicates the entire row
Example: Sed-r ' s# (. *) Fff#\1#g ' oldboy.txt matches the characters in front of FFF and outputs
Sed-r ' s# (. *) (. *) #\1 \2#g ' oldboy.txt matches characters before and after spaces and outputs
awk Command Combat:
awk ' {print '} ' Oldboy.txt takes the first column
awk ' {print $ oldboy.txt} ' takes first, two columns
awk ' {print $NF} ' Oldboy.txt takes the last column
Awk-f "Specify delimiter" ' {print $NF} ' Oldboy.txt
Cat-n Display the line number of the file
awk ' {nr>20&&nr<26} print $/etc/passwd prints 21-25 lines
grep command Combat:
grep***** (good at filters) separate the desired or unwanted (the default whole line)
-V Exclusion
-I is case insensitive
-E Filter Multiple strings
-O outputs precisely matched characters without
-N Line number
Linux Three Musketeers old three
-B In addition to displaying a matching row, and displaying the NUM lines before the line
-a displays a matching row and Num lines after that line
-c Displays the NUM row before and after the line, except for a matching row
grep "string"-B 1.txt
--color=auto to match the string to a color
grep 3306/etc/services
grep--color=auto 3306/etc/services
Very important basic Commands Three Musketeers plus find