Brother Bird's Linux private Cuisine--15th chapter: Formal notation

Source: Internet
Author: User

Video link

Potatoes:

Station B:

This chapter is about

The directory is as follows

1.Objective:
2.Basic formal notation:
2.1ingrepRetrieving charactersString (Grep-iv I is ignoring case, V is reverse selecting show no search string ' search string ' filename)
2.2Important special characters(characters) ([] ^ $ *)
3.Extended formal notation: (+? | () )
4.Format printing:printf ()
5. sed Introduction to Tools (SED ' 1a: '   A added  d delete  c replace)
6. awk Introduction to Tools (awk  nf The total number of fields in each row     NR is currently in line    FS current delimiter, default is space)
7. file data relative to print ()
7.1 file comparison: diff, CMP, Patch (diff old file New file  cmp-s old File New file CMP default output first different point,-s output all  patch to take advantage of. Patch diff file, also in the folder)
7.2 Span class= "Fontstyle2" > archive print ready: PR () span>

1.grep Search

1. [] The letters inside, no matter how many of them refer to a

2.grep Reverse selection ^ Note! ^ must be in [] inside is the reverse selection

3. Beginning ^ Line End $

4.*

Extended formal notation

Sed

The following examples show the results, and the contents of the file itself are not changed

So what if we want to change the contents of the document? It's just a plus-I.

// For example I want to modify vae.c this file, add vae below line 2nd, that is, the 3rd line is Vae ' 2a Vae ' vae.c // now I want to remove VAE, notice is to delete the 3rd line AH ~ ' 3d ' vae.c

Awk

Did you find a problem with line 2nd 32? Since 2 32 rows of data have spaces or tabs, be aware that your data has spaces or tabs when using awk to process data.

Also note that this is the line, $ $ is the first column, and the second column is ... Etc. v

Diff

is to compare the differences between the two files, often with the patch command

I changed a file

CMP compares two files, in bits

Patch let's explain a simple usage

First of all, write two different files into one document note! Diff must be added-naur

pr

Brother Bird's Linux private Cuisine--15th chapter: Formal notation

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.