Linux Learning Notes (25) Shell special symbols, Sort_wc_uniq, tee_tr_split

Source: Internet
Author: User

one, special characters

1.
Any character of ' * '
‘? ' Any one character
' # ' comment characters
' \ ' de-semantic characters
' | ' Pipe character
Most of them have been used before, for the caret ' \ '

Examples of the use of the caret

2. Several pipe-related commands
Cut split,-D delimiter-f Specifies the segment number-C to specify the first few characters


Sort sorted,-N with numeric sort-R reversed-T delimiter-kn1/-kn1,n2
Sort 1.txt//sorting 1.txt
Special characters are least, numbers are second, followed by alphabetical order


Sort-n 1.txt//sorted by number size, special characters and English default size is 0


Wc-l statistics number of rows-m statistic characters-W statistics
-M includes newline characters
-W is separated by a space


Uniq to weight,-c count rows
Uniq need to sort and then go heavy, if not sorted, cannot go to heavy


Tee and > similar, redirect while still on screen display
Output redirection does not display content, tee is displayed on the screen while redirecting
Tee-a Append

TR replacement character, tr ' a ' B ', case replacement TR ' [A-z] ' [A-z] '

Split Cut,-B size (default unit byte),-L line number
find/etc/-type f-name "*.conf"-exec cat {} >>a.txt \;




If you do not specify a name after the cut, the file name is followed by the letter X

Medium ABC is the beginning of the specified file name
Split-l cut by number of lines


Second, special symbols

$ 变量前缀,!$组合,正则里面表示行尾 ;多条命令写到一行,用分号分割 ~ 用户家目录,后面正则表达式表示匹配符 & 放到命令后面,会把命令丢到后台 >                   // 正确重定向  >>               //正确追加重定向   2>             //错误重定向     2>>          //错误追加重定向     &>           //正确错误重定向 [ ] 指定字符中的一个,[0-9],[a-zA-Z],[abc] || 和 && ,用于命令之间

|| Or


Select one, the previous command will not execute the following command if it succeeds
&& the previous command succeeds before the command is executed.

Linux Learning Notes (25) Shell special symbols, Sort_wc_uniq, tee_tr_split

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.