"Linux" text extraction

Source: Internet
Author: User

Extract IP address :

Method ①:

" : " " " -f1

ifconfig: The command that displays or configures the network device is followed by the device name.

The Ifconfig eth3 is displayed as follows:

grep: followed by a regular expression that displays the rows that appear in the regular expression

The Ifconfig eth3|grep bcast is displayed as:

cut:-D followed by the number after the delimiter-F indicates the first data to get the split

Ifconfig eth3|grep bcast|cut-d ":" After-f2 shown as:

Ifconfig eth3|grep bcast|cut-d ":"-f2|cut-d ""-f1 then acquired the IP address

Awk Small Example

From http://www.cnblogs.com/xupeizhi/archive/2012/07/23/2605371.html

① output file contains rows that conform to a regular expression

awk '/111*/' text output text file contains rows that conform to the 111* field

② the nth field of each row in the output file

awk ' {print '} ' text output text file in the first field of each line

awk ' {print $1,$3} ' text output text is separated from the first and third fields in each line

"Linux" text extraction

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.