Linux command line text processing tool

Source: Internet
Author: User
Linux command line text processing tool based on the keyword search command grep is used to search text command format grep & quot; keyword & quot; based on the keyword, and usually used together with the pipeline, such as ls-l | grep & quot; test & quot ;. the following are common parameters-when searching... linux command line text processing tool based on the keyword search command grep is used to search text command format grep "keyword" based on the keyword, and is usually used with the pipeline, such as ls-l | grep "test ". the following are common parameters: I ignore the case when searching.-n shows the row where the result is located.-v outputs the row without the keyword.-Ax contains the row where the result is located after the output (after) the specified number of rows-Bx contains the specified number of rows before the result row (before). The cut command is used to process the text based on the column text content. example: cut-d: -f1/etc/passwd: use ':' As the delimiter and output the first column, which separates the/etc/passwd file, the following are common parameters:-d specifies the delimiter (TAB by default)-f specifies the output column number-c based on words for cutting, for example, cut-c2-6/etc/passwd, that is, the output of each line of/etc/passwd, the 2nd to 6th characters of the text statistics command wc force statistics text information examples: such as wc OK. cpp. The following are the displayed results and explanations 9 23 96 OK. number of cpp lines, 9 words in total, 23 words in total, 96 bytes in total, called OK. cpp the following are common parameters-l only count the number of rows-w only count the number of words-c only count the number of bytes-m only count the number of characters text sorting command sort to sort the text content examples: for example, sort file-r sorts data in reverse order-n sorts data based on numbers-f ignores case-u deletes duplicate rows-t c uses c as the separator for column sorting-k x specifies which sort keys, it is usually used to sort columns based on specified characters, the sort-u command can be used to delete duplicate lines. the uniq command is used to delete duplicate adjacent lines. the comparison command diff is used to compare the differences between two files. The following are common parameters. -I ignore case-B ignore the number of spaces change-u display the comparison information (usually used to generate patch files) check spelling command aspell used to display check English spelling process text content command tr used to process text content delete keyword tr-d "TMD"
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.