Linux sed seq awk section

Source: Internet
Author: User

   #include  <iostream>using namespace std; int main () {           int a[4]={1,2,3};         cout<<2[a]<<endl;return 0;} [[email protected] 20160731]$ echo  "wz"  | grep  '. ' wz[[email protected] 20160731]$ echo  "wz"  | grep  ' W ' wz[[email  protected] 20160731]$ echo  "Wz zx"  | grep  ' wz. ' wz zx[[email protected] 20160731]$ echo  "Wz zx"  | grep  ". Z ' wz  zx[[email protected] 20160731]$ supassword: [[email protected] 20160731]#  echo  "Wz zx"  | grep  '. Z ' wz zx[[email protected] 20160731]#  echo  "Wz zx"  | grep  '. X ' Wz zx[[email protected] 20160731]# echo   "WZ&NBSP;ZX"  | grep  ' w[abcz] ' wz zx[[email protected] 20160731]# echo  "WZ&NBSP;ZX"  |  grep  ' w[0-9] ' [[email protected] 20160731]# echo  "wz zx"  | grep  ' W [^0-9] ' wz zx[[email protected] 20160731]# echo  ' wz zx '  | grep  ' w[ [:d igit:]] ' [[email protected] 20160731]# echo  "Wz zx"  | grep  ' W[[:alpha:] ' wz  zx[[email protected] 20160731]# echo  "Wz zx"  | grep  '.? ' [[email protected] 20160731]# echo  "Wz zx"  | grep  ". + ' [[email  protected] 20160731]# echo  " | grep ". + ' [[email protected] 20160731]#  echo  "a"  | grep  ". + ' [[email protected] 20160731]# echo " A2 "  | grep  '. [2-5]+ ' [[email protected] 20160731]# echo  ' A2 '  | grep  '. [2-5]? ' [[Email protected] 20160731]# echo  "A2"  | grep  ". {3,} ' [[email protected] 20160731]# echo  ' A22 '  | grep  '. {3,} ' [[email protected] 20160731]# echo  ' A22 '  | grep  '. {3} ' [[email protected] 20160731]# echo  ' a22123 '  | grep  '. {3} ' [[email protected] 20160731]# [[email protected] 20160731]# echo  ' A22123 " | grep ". {, 3} ' [[email protected] 20160731]# [[email protected] 20160731]# echo  "AAA"  | grep  ' a{1,3} ' [[email protected] 20160731]# echo  "AAA&NBSP;BBB"  |  grep  ' ^b ' [[email protected] 20160731]# echo  "aaa bbb"  | grep   ' ^a ' aaa bbb[[email protected] 20160731]# echo  "aaa bbb"  | grep   ' b$ ' aaa bbb[[email protected]alhost 20160731]# echo " aaa bbb  " | grep  ' b$ ' [[email protected] 20160731]# echo " AAA  bbb  " | grep  ' b\b ' aaa bbb [[email protected] 20160731]#  echo  "aaa bbb "  | grep  ' b\b ' aaa bbb [[email protected]  20160731]# echo  "aaa bbb "  | grep  ' \b ' aaa bbb [[email  protected] 20160731]# echo  "aaa bbb "  | grep  ' \ba ' aaa bbb [[ email protected] 20160731]# echo  "xxaaaxx bbb "  | grep  ' \Ba\B ' xxaaaxx bbb [[email protected] 20160731]# echo  "aaa bbb "  |  grep  ' \ba\b ' aaa bbb [[email protected] 20160731]# echo  "ab121212 "  | grep  ' 12{3} ' [[email protected] 20160731]# echo  "ab121212222 "   | grep  ' 12{3} ' [[EMAIL&NBsp;protected] 20160731]# echo  "ab121212222 "  | grep  "{3} ' [[email  protected] 20160731]# echo  "ab121212222 ()"  | grep  "\ (\) {3} ' [[email  protected] 20160731]# echo  "ab121212222 ()"  | grep  "\ (\) $ ' ab121212222 () [Email  protected] 20160731]# echo  "ab121212222 ()"  | grep  "\ (\) $| (12) {3} ' [[email protected] 20160731]# [[email protected] 20160731]# echo  ' ab121212222 () " | grep " \ (\) $| (12) {3}|^a ' [[email protected] 20160731]#  190  vim file   191   grep  ' [0-9]{2,11} '  file  192  grep -E --color  ' [0-9]{ 2,11} '  file  193  grep -E --color  ' ^[0-9]{2,11}$ '  file   194  history 5   match phone  1 start   second bit not for 1 2 6   all is the number opening to the end [[email protected] 20160731]# grep -e --color  ' ^1[345789][0-9]{2,11}$ '  file[[ email protected] 20160731]# grep -e [email protected]$ '  file>  History 5^c Match mailbox   characters start    end of standard symbol [[EMAIL&NBSP;PROTECTED]&NBSP;20160731]#&NBSP;GREP&NBSP;-E  --color  ' ^[a-za-z0-9_][email protected]$ '  file[[email protected] 20160731]#  grep  --color  ' ^[a-za-z0-9_][email protected]$ '  file[[email protected]  20160731]# grep  --color  ' ^[a-za-z0-9_]\[email protected]$ '  file matching ip   3 segment Repetition   [[email protected] 20160731]# grep  --color  ' ([0-9]{1,3}.) {3} [0-9] {1,3} '  file[[email protected] 20160731]# grep  --color  ' ^ ([0-9]{1,3}\.) {3} [0-9] {1,3}$ '  file[[email protected] 20160731]# grep  --color  ' ^\ ([0-9]\{1,3\}\.\ ) \{3\}[0-9]\{1,3\}$ '  file-e extension benchmark match    ()   |  {} + ?   Special meaning    literal meaning need to escape the regular benchmark match "character class    number of times limit   position limit"  6. Draw 10 straight lines at 9 points, requiring at least three points per line? (3 min-20 min)   3 4 3 4 6 4 3 4 3   high reusability   to (0, 0) for Heart    side length  2    Square 4 corner Plus ( -1,0)   (1,0)   (0,2) (0,-2)   "sed"   read one line from file to match processing   to Buffer   (alias   mode space) [[email protected] 20160731]# sed  '/^c/s/^/\/\//'  abc    aaabbb//cccddd[[email protected] 20160731]# sed  '/c$/p '  abc      Find    Properties aaabbbccccccddd[[email protected] 20160731]# cat  abcaaabbbcccddd[[email protected] 20160731]# sed -n  '/c$/p '  abcccc[[email  protected] 20160731]# sed -n  '/^.*\/\//d '  abc     does not affect the original file [[email  protected] 20160731]# cat abcaaabbb//cccddd[[email protected] 20160731]# sed -i  '/^.*\/\//d '  abc    Delete comment lines in the ABC file    -i option [[email protected] 20160731]# cat abcaaabbbddd[[email protected]  20160731]# sed -i  '/ddd/s/ddd/ccc/g '  abc    to replace DDD lines with ccc[[email  protected] 20160731]# cat abcaaabbbccc[[email protected] 20160731]#  Comment  5 to  10   Line 5,10 s/^/\/\//[[email protected] 20160731]# sed    '/a\ +/s/a/~a~/'  abc//~a~aa//bbb//ccc[[email protected] 20160731]# sed    '/a\+/s /a/~a~/g '  abc    plus g options are executed multiple times//~a~~a~~a~//bbb//ccc[[email protected] 20160731]#  sed -n  ' 3p '  abc//ccc[[email protected] 20160731]# sed -n  ' 1,3p '  abc   Print line 3rd and top 3 lines//aaa//bbb//ccc[[email protected] 20160731]# sed -n    '/aaa/,/ccc/p '   abcEquivalent to printing with labels  //aaa                                                  //bbb//ccc[[email  protected] 20160731]# sed -n   '/aaa/,3p '   abc        can be mixed with//aaa//bbb//ccc[[email protected] 20160731]#  below for 3 examples eg1 keep space, where the factory stores the product or the semi-finished goods   sed      mode space           Keep Space factory       assembly Lines            warehouses (1. By default   SED does not use save space and is used only when certain commands are displayed) (2. Just save the data and bring unexpected results) gg h hget  hold   caps are all added   Do not refresh n      will refresh  N  update a row [[email protected] 20160731]# cat  Abc//aaa//bbb//ccc[[email protected] 20160731]# sed  ' G '  abc    display line//aaa//bbb//ccc [[ email protected] 20160731]# sed  '/b$/g '  abc    specifies the line at the end of the line  b empty line//aaa// bbb//ccc[[email protected] 20160731]# tac abc           reverse reading//ccc//bbb//aaa[[email protected] 20160731]# sed -ne  ' H;${x;s/\n/ &NBSP;/G;P} '  abc  column interchange   semicolon, plus multiple command  h that is hold meaning  //aaa //bbb //ccc [[email  Protected] 20160731]# seq  1012345678910[[email protected] 20160731]# sed  -e  '/ddd/h '   -e  ' $G '   abc//aaa//bbb//ccc[[email protected]  20160731]# cat abc//aaa//bbb//ccc[[email protected] 20160731]# sed -e  '/ddd /h '   -e  ' $G '   abc   unsuccessful//aaa//bbb//ccc[[email protected] 20160731] # seq 100 | sed -ne  ' h;${x;s/\n/*/g;s/^*//;p} ' 1*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19*20*21*22*23* 24*25*26*27*28*29*30*31*32*33*34*35*36*37*38*39*40*41*42*43*44*45*46*47*48*49*50*51*52*53*54*55*56*57*58*59*60 *61*62*63*64*65*66*67*68*69*70*71*72*73*74*75*76*77*78*79*80*81*82*83*84*85*86*87*88*89*90*91*92*93*94*95*96* 97*98*99*100[[email protected] 20160731]# seq 100 | sed -ne  ' H;${x;s/\ n/+/g;s/^+//;p} '  | bc5050[[email protected] 20160731]# sed -n  ' N;p '   abc    Odd line//bbb[[email protected] 20160731]# sed -n  ' P;n '  abc    even lines   starting from 0//aaa//ccc[[email protected] 20160731]# awk  ' {print $2;} '  abc112233[[email protected] 20160731]# awk  ' {print $0;} '  abc//aaa    11//bbb    22//ccc    33[[email  protected] 20160731]#


Linux sed seq awk section

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.