2017-10-9linux Text Processing

Source: Internet
Author: User
Tags numeric value

Text Processing: Cat, TAC, more, less, head, tail, cut, sort, uniq, grep

Regular expressions

Pipelines and redirects: > < >> <<

Users, Groups, permissions


View text: Cat, TAC, more, less, head, tail

Cat (CONCATENATE): Connect and display

-N: Display line number-e: Display line terminator (for Linux, the line terminator of the text file shi$,windows the line terminator is $/n)

TAC: Connection and display (inverted)


Split screen view: More (Turn back, turn to the end of the file automatically exit) less (can be turned around, turn to the end of the file will not automatically exit, only enter Q exit)


Head: View top N rows tail: View the last n rows support-n Display line numbers

Tail-f: Look at the end of the file, do not exit, wait to display the new content appended to this file later


Text processing: Cut, join, SED, awk

Cut: Cut

-D: Specify delimiter, default is space-F: Specifies the field to display,-F 1,3-f 1-3

Example: cut-d:-F 1,7 file displays files as: 1th and 7th parts of separators


Text sort: Sort (sort and cut does not affect the source file's data, just displayed on the screen) by default is sorted by ASCLL ascending order

- N: Sort by numeric value-r: Reverse order, descending- T: Set delimiter-K: Specifies the field to display-u: the same line after sorting only shows once sort-u is equivalent to Uniq -F: Ignore character capitalization when sorting

Uniq: -C: Displays the number of repeats in a file-D: Show only duplicate rows


Text statistics: WC (word count)

-L: How many lines-W: How many words-C : How many characters-L: The longest line contains the number of characters


Character processing command: TR---convert or delete characters

For example: tr ' A-Z ' A-Z ' </etc/passwd converts A-Z in a file to a A-Z

-D: Delete all characters that appear in the character set


This article is from the "11254884" blog, please be sure to keep this source http://11264884.blog.51cto.com/11254884/1971027

2017-10-9linux Text Processing

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.