linux file processing tool

File Viewer command: cat, nl, tac, rev

The cat command

Options:

-E: display linefeed $
-n: for each line exhibited numbered
-A: show all control characters
-b: non-empty line number
-s: compressed air line into a continuous row

more: Paging File View

-d: display the page and quit tips

less: a file or to view an output STDIN
useful when viewing commands include:
/ text search text
n / N skip to the next or previous match a
less man command is a command to use pager

head command

Options

-c # # bytes specified before acquisition

-n # Specifies the acquisition front row #
- # Specifies the number of lines
tail

Options:

After obtaining the specified -c # # bytes
-n # # after obtaining a specified line
- # ditto
-f trace shows the file fd newly added content, commonly used log monitoring
equivalent = descriptor --follow
-F trace file name, equivalent to - -follow = name --retry

cut command:

Options:

-d DELIMITER: specified separator, default Tab
-f Fileds:
#: # The first field
# # [#]: a plurality of discrete fields, e.g. 1,3,6
# - #: a plurality of consecutive fields, 1-6, for example,
in combination: 1-3, 7
-C cutting by character
--output-delimiter = STRING specifies an output delimiter

wc command

Options:

counting only the number of rows -l
-w only count the total number of words
-c only count the total number of bytes
-m only count the total number of characters
-L shows the length of the longest line in the file

sort command

Options:

Finishing -r perform the reverse direction (top to bottom)
-R random sort
-n perform numerical size sort
-f option ignores character case (fold) string
-u option (unique, unique) to delete duplicate output line
-tc option to use c as field delimiter
-k X X column using options as a character-delimited c can be used multiple times to organize

uniq command: Remove duplicate lines before and after the input contact from

Options:

-C: display the number of times each line is repeated
-d: Only been repeated lines
-u: Display only never duplicate rows
Note: Continuous repetitive and identical side

grep command

Options:

    --color = auto: text matching the color display
-m # # match after stopping times
-v display is not matched to the line pattern
-i ignore character case
-n line numbers match
- c statistical matching the number of rows
-o show only the matched character string
-q silent mode does not output any information
-a # after, the # line
-B # before, before the line #
-C # context, each longitudinal row #
-e implementing logical relationship between the plurality of options or
    grep -e 'CAT' -e 'Dog' File
-W whole words
-E using the ERE
 equivalent-F. fgrep, does not support regular expression formula
-f file processing according to the schema file

Anchor position: positioning to appear
^ first anchor line, the leftmost mode for
$ anchored end of the line, for the rightmost pattern
^ $ for pattern matching the PATTERN entire line
^ $ empty line
^ [[ : space:]] * $ blank line
\ <or \ b word first anchor, the left side for the word mode
\> or \ b ending anchor for word patterns right side
\ <pATTERN \> matches the entire word

egrep command

 

Guess you like

Origin www.cnblogs.com/guopeijun123/p/10995864.html