Linux Learning Notes < three >--common view text commands and Text processing commands

Source: Internet
Author: User

To view text:

1.cat: Connect and display text

Inverted display of the Tac:cat

-N: Add rows at the beginning of each line display

-E: line breaks displayed per row

-A: Displays all, including text and various special symbols

The text newline character for Linux is $, and the text line break for Windows is $+enter


2. More and less for split-screen display

MORE: Turn back, turn to the end and quit.

Less: Turn back, turn to the end and not automatically exit

The more and less display Windows operate:

Turn back one page: Space key

Turn One page forward: B key

Exit display window: Q key


3.head: View Top N rows

Tail: View after n rows

-N Number =-Number: View how many rows

No option, the default is to display 10 rows

Tail-f: View the end of the file, does not automatically exit, you can wait to show other users later append to this file new content.



Text Processing:

1.cut: Crop text after display

-D: Specifies the field delimiter, which is the default space

-F: Specify the fields to display

Example: cut-d:-f1,3/etc/passwd

cut-d:-f1-3/etc/passwd


2.sort: Sort text after display

-N: Numeric sorting

-R: Descending

-T: Field delimiter

-K: One of the fields is sorted by keyword

-U: The same row is only displayed once after sorting

-F: Ignore character case when sorting

Example: sort-t:-k3/etc/passwd to compare the third field in the/etc/passwd with: separate, left-to-right


3.uniq: When no option is added, duplicate rows are displayed only once, and non-repeating rows are displayed correctly

-C: On the default basis, the beginning of the line with the number of repetitions, normal display 1, there are repeated display repeat number

-D: Show only duplicate rows

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6F/F6/wKiom1WuLhLDluZ6AACWjpb3gjY622.jpg "title=" uniq command "alt=" Wkiom1wulhldluz6aacwjpb3gjy622.jpg "/>


4.WC (Word count): text statistics

-L: Displays the number of lines of text

-W: The number of words that display text

-C: The number of bytes (characters) to display text

-L: The number of bytes (characters) that show the longest line

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/F6/wKiom1WuL8bQbcrdAAC6U2ZlZ0w823.jpg "title=" WC Command " alt= "Wkiom1wul8bqbcrdaac6u2zlz0w823.jpg"/>


5.tr: Convert or delete characters, not with access parameters, need to use with piping

format; tr [OPTION] ... SET1 [SET2]

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6F/F6/wKiom1WuMPDRceYyAACoHAw8Pnk288.jpg "title=" tr Command " alt= "Wkiom1wumpdrceyyaacohaw8pnk288.jpg"/>


Linux Learning Notes < three >--common view text commands and Text processing commands

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.