Common commands for text processing of Linux learning

Source: Internet
Author: User
Tags printable characters repetition

1. Cat (CONCATENATE): Outputs the file or input data

-a--show-all: equivalent to-vet

-B--number-nonblank: Number of non-null output lines

-e equivalent to-ve

-e--show-ends show $ at end of American Airlines

-N--number: Numbering All lines of the output

-S do not enter multiple lines of blank lines

-T vs.-VT equivalence

-T--show-tabs will jump characters as ^i

-V uses ^ and M- references, except LFD and tab

2, more split screen view text file does not support page back



3. Less is similar to the more command, but you can view the contents of the next page by flipping the key (man is calling this command)

-e automatically exits when the file display finishes

-F Force open special files, such as peripherals files, directories, and binaries

-G only indicates the keyword of the last search element

-I ignores case when searching

-m display percent

-N Display Line number

-o< filename > Save less output file contents in specified file

-Q does not use warning tones

-S displays a row of continuous empty behavior

-x< number > tab display as a specified number of spaces

Command internal operations

b Turn back one page

D Turn back half a page

H Display Help interface

Q Exit Less command

U Turn Half page forward

Y Scrolls forward one line

SPACEBAR Scrolls one page

Enter to scroll one line

Search Forward:/keywords

N: Looking forward for a matching text

N: Backwards

Search backwards:? keywords

N: Looking backwards for a matching text

N: Forward


Full Screen navigation:

Ctrl + F move forward one screen

Ctrl + B back one screen

Ctrl + D move forward half screen

Ctrl + U back half screen

Single-line navigation:

J Move forward one line

K Back

Tag navigation:

Ma use A to mark the position of text

' A navigate to mark a

Other navigation:

G move to last line

G Move to First line

Q or ZZ exit less

Edit Mode Press V to call VI into edit mode

4, head view the first few lines of the file

-C Display the pre-K content of the file--for example,-c 2k display the front 2k content,-c-2k display except the last 2k content

-N Displays the first n rows of the file with the-K parameter, for example, the Head-n-10 file name displays data except for the last 10 rows

-Q does not display the file header for the given file name

-V always displays the file header for the given file name

5. Tail view the following lines of the file

-C outputs the last n bytes

-F When the file grows, output subsequent files

-N Outputs the last n rows to display data except the first 10 rows using the-n +10

-Q does not output file name

-V always outputs the header of the file name

-S is combined with-F to indicate sleep s seconds at each repetition interval



6, cut; Extract data in each line of a file

-B--bytes=list output these characters

-C--characters=list

-D--delimiter=delim Specifies that the field delimiter is blank by default

-F--fields=list Specify the fields to display

-S does not display lines without separators

7. Sort text Sorting

Default install ASCII code ascending sort

-F ignores uppercase and lowercase letters

-G installation General numeric sorting

-I sort printable characters only

-h use readable numbers such as 1k 2G

-N based on numeric string comparisons

-R sorted by random hash

-R Reverse Output sort result

8. Uniq Report Duplicate rows

-D displays only duplicate rows

-D Displays all duplicate rows

-C Displays the number of repetitions of a row

-U only displays unique rows

-S Skip top n characters when comparing

-I comparisons are case insensitive

-F Comparison Skip top n columns

-W does not compare the last n characters of each line

Uniq only the adjacent repeating row operations

9. WC: Text Statistics

-C--bytcs number of bytes printed

-M--chars print characters count spaces and line breaks

-L--lines Print line count

-L--max-line-length Prints the longest line length

-W--words number of printed words


10. tr Convert or delete characters

-D Delete matching content and do not replace

-S If there is a continuous repetition of the matched content in the sequence, it will be uniformly shrunk to a single character length when replaced


This article is from the "Pole Men" blog, please be sure to keep this source http://wtime.blog.51cto.com/8829658/1530366

Common commands for text processing of Linux learning

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.