-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- *-*-*-*-*-
Cyclic Judgment class
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- *-*-*-*-*-
For ((i=1;i<=10;i++));
Do
echo $ (Expr $i \* 3 + 1);
Done
Conditional double brackets are separated by semicolons, which are the initial values;
If [-F "$FILE"];then
echo "OK"
Else
echo "Error $FILE" > Error.log
Mail-s "$FILE backup fail" [email protected] <error.log
Fi
Start end With If---fi condition; if; then Else fi
While ["$var"! = "by"]
Do
echo "You input a char $var"
Read Var
Done
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- *-*-*-*-*-
Command class
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- *-*-*-*-*-
SORT-T:-n-k 1 new.txt (-t delimiter-n with pure digit-K number of domains-u go to heavy-r inverse sort,-f ignores letter case-o file)
1:hello
2:hehe
8:exit
10:haha
11:nihao
12:hello
Cut-d '-F 1 filename (-D delimiter-F Number of fields-C character-B byte utf-8 3 bytes a kanji)
Sed-n "1p" file (-n p partner using show line a next line increment I on line plus s replace "s/^s/title/g" D Delete)
Date-d "19700102 08:00:00" +%y-%m-%d:%h:%m:%s
1970-01-02:08:00:00
Date-s "20171111 11:02:00"
Uniq [-C |-D |-u] [-F fields] [-s characters] [-fields] [+characters] [InFile [OutFile]]
-C adds the number of times each line appears in the input file before the output line.
-D displays only duplicate rows.
-U displays only rows that are not duplicates.
The-f field ignores the number of fields that are specified by the domain variable.
-S characters ignores the number of characters specified by the characters variable
Cut-d ': '-F 2 new.txt |sort-r |uniq-c-D
2 Nihao
2 Hello
2 hehe
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- *-*-*-*-*-
Regular class
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- *-*-*-*-*-
Base *, \<\>, \{n,m\}, extended +,? , which is the number of characters in front of it. <<< Focus <<<<
#例子 New.txt
12:hello
2:hehe
10:haha
11:nihao
1:hello
20:nihao
19:hehe
8:exit
23.bay
$grep-E ' ^[1-9]:.*[t]$ ' new.txt <<<<< examples <<<<
8:exit
Grep-e "\<ni\>" New.txt <<<<< example <<<< \<ni\> to complete the word!!!
Results not found
$ sed ' s/ni/\*/g ' new.txt |grep-e ' \11:*hao
20:*hao
$sed "s/[:.] /\+/g "New.txt <<<<< examples <<<<
12+hello
2+hehe
.....
23+bay
$ sed "s/[l]\{2\}/\*\*/g" new.txt <<<<< example <<<<
12:he**o
2:hehe
$ sed ' s/ni/\*/g ' new.txt <<<<< example <<<<
...
11:*hao
...
$ awk-f[:] ' {print $, ' \ t ', ' $ $ ' new.txt | $awk-f: ' {print $ \ t ' $ ' $ ' $ ' new.txt <<< ' The difference between the examples <<<<<< ;
Hello |12hello
2 hehe|2 hehe
.... | ....
CAT/ETC/PASSWD |awk-f ': ' BEGIN {print ' Name,shell '} {print $ ', ' $7} END {print ' Blue,/bin/nosh '} '
Awk-f: '/root/{print $7} '/etc/passwd
awk '/root/'/etc/passwd = = Grep-e ' root '/etc/passwd
$awk-F Awk.sc new.txt
#awk. SC
begin{fs= ":";p rint "Begin"}
{Print $}
End {print "End"}
Sort cut awk's domain symbol!!!!
Sort-t ': '-K 1
Cut-d ': '-F 1
awk-f[:.] {print $ <<<<< example <<<< [Regular: OR.] Not supported if sort or cut is not supported
Shell Review Notes