8.10 shell special symbols cut command 8.11 sort_wc_uniq command 8.12 tee_tr_split command 8.13 shell special symbols

8.10 Shell special symbol cut command
8.11 sort_wc_uniq command
8.12 tee_tr_split command

8.13 Under special shell symbols


shell special symbol cut command

*any arbitrary character -- wildcard

? any character

#comment characters

\ escape character

|pipe


cut command: used to intercept a field or character

-d: delimiter -f specifies the segment number -c specifies the number of characters

Command format: cut -d ':' -c/f n {n is a number} Note: Represents the number of blocks and the number of characters to be split

Example: -f usage


-c usage:


sort: used for sorting

-n: use pure numeric sorting (special symbols will start with the number 0)


-r: sort in reverse order


-d: split character, sort by split character


wc command:

wc -l : count the number of lines


wc -m: count the number of characters (including hidden $)


wc -w: count the number of words


wc does not follow anything: count the number of lines, characters and words


uniq: You must sort first to remove duplicates

Command format: uniq 

-c: count the number of duplicate rows, the premise must be sorted first

tee:

tee -a: added

Similar to redirect>, it will be displayed on the screen when the file is written to the following document

tr: used to replace characters

Command format:

Replacement characters: tr '[aZ]''[ZA]'-----Comment: Specify the range


Replace a single character tr 'rR' Comment: Specify a single character


-d: delete a character


split: cut

 Command format: split option filename

-b: Split documents by size:      


-l: split the document by the number of lines


Under shell special symbols:

$variable prefix------! $combination, execute the previous variable


; Write multiple commands on one line, use ; to indicate


~User home directory

& put after the command, it will drop the command to the background


[ ] specifies one of the characters, such as [0-9]

||: For example, cat /etc/fstab||wc -l----When cat is executed successfully, wc will not be executed, and if it fails, touch will be executed


&&: For example: wc-l && cat Cat can only be executed after wc is executed successfully


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324691350&siteId=291194637