Linux Shell common Commands

Source: Internet
Author: User
Tags get ip

  1. For loop

    applist= (App1 app2 app3); for apps in ${applist[@]};d o echo $app;d one;

  2. Get IP Address

    Ifconfig |grep-po ' (? <=ADDR:). * (? =BC) '

    Ifconfig|awk-f "[:]+" ' $4~/[0-9].+[^0-9]+/{print $4}/lo/{exit} '

    Ifconfig|sed-nr ' s/^[[:space:]]+inet addr: (. *) bcast.*/\1/p '

    Ifconfig | Grep-o ' \ ([1-9]\{1,3\}\.\) \{3\}[0-4]\{3,\} '

  3. Format output document

    cat xxxx | awk  ' {print  "n" NR "= "$," "M" NR "=" $ "|column -t formatting the output document

  4. Output a log for a certain time period

    Sed-n '/2015-07-27 11:00/,/2015-07-27 11:20/p ' Xxx_server_log > Dsadsads.log

    Sed-n '/06\/dec\/2016:20:30:00/,/06\/dec\/2016:21:00:00/p ' json_access.log.2016-12-06 > Dsadsads.log #加了转义

  5. echo No newline output

    Echo-n "XX";

  6. Output line breaks or tab keys in awk or Echo

    Echo-e "123\t345" >/tmp/123.txt;cat/tmp/123.txt | awk ' {print ' "\t,\n"

  7. Cond

This article from the "Dream do not know is a guest" blog, please be sure to keep this source http://tenfee.blog.51cto.com/6353835/1918958

Linux Shell common 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.