Linux5.4 Shell special symbols and piping related commands

Source: Internet
Author: User

Special Compliance
        1. * Any of the characters 2. ? Any one character 3. # comment Character 4. \  de-semantic character 5. |  Pipe character 6. The $ variable prefix, which represents the row bit 7. ; Multi-line command line input, split with 8. ~ User home directory, regular indicates match 9. & After the command is placed, the command will be dropped to the background.  >  >>   2>  2>>   &>11. [] One of the specified characters, [0-9][a-za-z][abc]12. ||   &&            | | In the shell is or means, the first one is not successful execution of the second, success is not executed in the second article              && the  first successful execution of the second article        
Cut intercept Segmentation
#-D delimiter  #-F Specify segment number #-C to specify the characters, use-C do not use-d-f[[email protected] tmp]# head-2 passwd.txt |cut-d ': '-f 2,4,7x:0:/bin/ba Shx:1:/sbin/nologin[[email protected] tmp]# head-2 passwd.txt |cut-c  2,4,7ot:i:1
Sort sorts
#sort常与uniq "To repeat" together with #-n  to sort by numbers, letters or special symbols think 0#-r   #-t   delimiter, for the first paragraph sort, with-K  -kn1,n2 "rarely used" [[Email Protected] tmp]# head-4 passwd.txt  |sort-nadm:x:3:4:adm:/var/adm:/sbin/nologinbin:x:1:1:bin:/bin:/sbin/ Nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinroot:x:0:0:root:/root:/bin/bash[[email protected] tmp]# head-4 Passwd.txt  |sort-rroot:x:0:0:root:/root:/bin/bashdaemon:x:2:2:daemon:/sbin:/sbin/nologinbin:x:1:1:bin:/bin :/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologin[[email protected] tmp]# head-4 passwd.txt  |sort-t ': '-k3root : X:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4: Adm:/var/adm:/sbin/nologin
Number of WC statistics rows
#-l count the number of    rows #-m  Statistical characters, count the number of hidden characters #-w  statistics, divide words with blank characters [[email protected] tmp]# head-4 passwd.txt  |wc-m142[[ Email protected] tmp]# head-4 passwd.txt  |wc-l4[[email protected] tmp]# head-4 passwd.txt  |wc-w4[[email Protec TED]02 tmp]# cat! $cat 234234.txt123asdf werr,asdf[[email protected] tmp]# wc-w! $WC-W 234234.txt3 234234.txt#cat-a View hidden character, where the line break [[email protected] tmp]# cat-a passwd.txt| Head-4root:x:0:0:root:/root:/bin/bash$bin:x:1:1:bin:/bin:/sbin/nologin$daemon:x:2:2:daemon:/sbin:/sbin/nologin $adm: x:3:4:adm:/var/adm:/sbin/nologin$
Uniq to Heavy
# just the same weight as the two lines next to each other, so you need to sort first. #-C    count rows [[email protected] tmp]# cat! $cat 234234.txt123123345456asdfb34502asdf werr,asdf[[email protected] tmp]# Sort!$|uniq-csort 234234.txt|uniq-c      1      2 123      2 345      1 456      1 ASDFB      1 asdf werr,asdf
Tee command
# with output redirection > similar, redirect to the following file while the screen is displayed. #-a   append [[email protected] tmp]# sort 234234.txt|uniq-c| Tee ty.txt      1      2 123      2 345      1 456      1 ASDFB      1 asdf werr,asdf[[email protected] tmp]# cat ty.txt      1      2 123      2 345      1 456      1 ASDFB      1 asdf Werr,asdf
TR Replacement Character
[Email protected] tmp]# echo "Chyuanliulinux" |tr ' l ' l ' chyuanliulinux[[email protected] tmp]# echo "Chyuanliulinux" |tr  ' Li ' L ' chyuanllullnux[[email protected] tmp]# echo "chyuanliulinux" |tr ' li ' li ' chyuanliulinux[[email protected] tmp]# echo "Chyuanliulinux" |tr ' A-Z ' A-Z ' chyuanliulinux
Split cut
#-B Size "default unit Byte" #-L line # If the target file name is not specified, the Xaa   xab ...   Such file names are accessed after the cut files.  You can specify the target file name [[email protected] ty]# du-sh ty.txt244k    ty.txt[[email protected] ty]# split-b 50k ty.txt[[email protected] ty]# lsty.txt  xaa  xab  xac  xad  xae[[email protected] ty]# du-sh x*52k     xaa52k     xab52k     xac52k     xad44k     xae[[email protected] ty]# split-b 50k ty.txt chy[[email protected] ty]# Lschyaa  Chyab  Chyac  chyad  chyae  ty.txt

Linux5.4 Shell special symbols and piping related commands

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.