The Three Musketeers of Linux

Source: Internet
Author: User

Accompanying notes:

grep filtering

SED fetch line
awk fetching columns

1. grep

grep Lookup

grep-v Filter Finder  

Syntax: grep content parameter line number file
-a displays matching rows and preceding rows
grep 30-a 1.txt Display 30 front 10 lines
-B displays matching rows and subsequent rows
grep 30-b 1.txt
-C Displays matching rows and displays the number of rows before and after matching
grep 30-c 1.txt

-I is case insensitive
-E Filter Multiple strings
-O output exact matching characters instead of the default entire line

2. Sed

SED replacement

Sed-i ' s# original character # destination character #g ' file name

Sed-i ' S#boy#girl#g ' test.txt

SED output

Sed-i '/character/p ' Find matching line output

Sed-i '/character/d ' Delete matching line output

3. awk

awk ' {print $n} ' output column n represents a column

The Three Musketeers of Linux

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.