Text Processing _ Division _ sorting _ statistics _ Line Editor

Source: Internet
Author: User
Tags first string modifier line editor

January 10, 2017, Tuesday Text Processing _ Division _ sorting _ statistics _ line compilationCompilation DeviceText file: tom:23:male:2013/05/06
Cut:-D: Specifies the field delimiter, which is the default space-F: Specify the fields to display-F 1,3-F 1-3
text sort: sort-N: Numeric sorting-R: Descending-T: Field delimiter-K: Which field is the keyword to sort-U: The same row is only displayed once after sorting-F: Ignore character capitalization when sorting Text statistics: WC (word count)-L-W-C-L
sed basic usage:Sed:stream EDitorLine Editor (full screen Editor: VI)SED: Mode space By default does not edit the original file, only the data in the pattern space to do processing, and then, after processing, the mode space to print to the screen;

sed [options] ' addresscommand ' file ...-N: Silent mode, no longer displays the contents of the mode space by default-I: Modify the original file directly-E script-e script: Multiple scripts can be executed at the same time-f/path/to/sed_scriptSed-f/path/to/scripts File-r: Indicates the use of extended regular expressionsCommand:D: Delete the qualifying line;P: Displays rows that match the criteria;A \string: Appends a new line after the specified line, with the contents of string\ n: can be used for line wrappingI \string: Adds a new row before the specified line, with the contents of stringR file: Adds the contents of the specified file to the qualifying lineW File: Save the row in the range specified by the address to the specified file;s/pattern/string/modifier: Find and Replace, default replaces only the first string in each line that is matched to the patternAdd modifierG: Global SubstitutionI: Ignore character cases///: s###, [email protected]@@\ (\), \1, \2L.. E:like-->likerLove-->loverLike-->likeLove-->love&: Reference pattern matches entire string
SED exercise: 1. Remove the blank characters from the beginning of the/etc/grub.conf file; sed-r ' [Email protected]^[[:space:]][email protected]@g '/etc/grub.conf2, replace/etc/ The number in the "Id:3:initdefault:" line in the Inittab file is 5;sed ' [email protected]\ (id:\) [0-9]\ (: initdefault:\) @\15\[email protected] '/ ETC/INITTAB3, delete blank lines in/etc/inittab file; sed '/^$/d '/etc/inittab

Null

Text Processing _ Division _ sorting _ statistics _ Line Editor

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.