cut, sort, awk, sed, tr, find, wc, unip usage in Linux

cut
语法
cut [-bn] [file]
cut [-c] [file]
cut [-df] [file]

-b: divided in units of bytes. These byte positions will ignore multi-byte character boundary, unless you also specify the -n flag.
-c: the character is divided into units.
-d: Custom separator, default tabs.
-f: Use with -d, which specifies the display area.
-n: Cancel split multi-byte characters. Only used with the -b flag. If the last byte of a character is indicated by List parameter falls -b flag is
in range, the character is written; otherwise, the character will be excluded

 

sort
Syntax
sort [-bcdfimMnr] [- o <output file>] [- T <separator character>] [+ <start column> - <End field>] [- help] [- verison] [ File ]

-b ignore the space character in front of each line start out.
-c Check whether the file has been sorted in the order.
When -d sorting, processing letters, numbers and space characters, but ignore other characters.
-f When ordering, lowercase letters as uppercase letters.
-i When ordering, in addition to ASCII characters between 040-176, ignore the other characters.
-m to merge several files sorted.
-M The first three-letter abbreviations be sorted by month.
-n sorted in accordance with size values.
-o <output file> The results sorted into the specified file.
-r sorted in reverse order.
-t field when <separator character> Specifies the sort used separator characters.
+ <Start column> - <End field> specified fields to sort, the range of the field from the start to the end of the previous field field.
--help Displays help.
--version display version information.

 

awk
Syntax
awk [option parameter] 'script' var = value file (s)
or
awk [Option parameter] -f scriptfile var value = File (S)
-F---field Separator FS or FS
input file specified delimiter off, fs is a string or a regular expression, such as -F :.
-v var = value or --asign var = value
assigned a user-defined variable.
-f scripfile or --file scriptfile
read the awk command from a script file.
-mf nnn and -mr nnn
set value nnn inherent limitations, -mf option to limit the maximum number of blocks allocated to nnn; -mr option limits the maximum number of records. These two features are extensions Bell Laboratories version of awk, awk does not apply in the standard.
-W compact or --compat, -W traditional or --traditional
run awk in compatibility mode. So gawk behavior and standard awk exactly the same, all the awk extensions are ignored.
-W copyleft or --copyleft, -W copyright or --copyright
print brief copyright information.
-W help or --help, -W usage or --usage
print a short description of all the awk options and each option.
-W lint or --lint
Can not print a warning to the traditional structure of the transplant unix platform.
-W lint-old or --lint-old
print warnings about not portable to traditional unix platform structure.
-W posix
turn on compatibility mode. With the following limitations, does not recognize: / x, function key, FUNC, the escape sequence, and when fs is a space, the new line as a field separator; and operator ** ** = not replace ^ and ^ =; fflush invalid.
-W re-interval or --re-inerval
allowed between the use of regular expressions, the reference (in the Posix character classes grep), as bracket expressions [[: alpha:]].
-W source program-text or --source program -text
using the program-text as source code, can be mixed with the -f command.
-W version or --version
print version information in bug reports.

 

sed
Syntax
sed [-hnV] [- e < script>] [- f <script file>] [Text File]

-e <script> or --expression = <script> option to specify the script to process the input text file.
-f <script file> or --file = <script file> In the options specified in the script file to process the input text file.
-h or --help Displays help.
-n --silent or --quiet or display only the results of the script processing.
-V or --version display version information.

 

tr
Syntax
tr [-cdst] [- help] [- version] [ first character set] [Second Character Set]
tr [the OPTION] ... the SET1 [SET2]

-c, --complement: Anti-selected set of characters. That is in line with SET1 part without processing the remaining part of the non-conforming only to convert
-d, --delete: delete character instruction
-s, --squeeze-repeats: continuous repetition of a single character down to the character specified
- t, --truncate-set1: reduction in the specified range SET1, SET2 is set to make the length equal
--help: display program usage information
--version: version information display program itself
scope set of characters:

\ Character NNN NNN octal value (1 to 3 octal value character)
\\ backslash
\ a Ctrl-G tones
\ b Ctrl-H backspace
\ f Ctrl-L Traveling feed
\ n Ctrl-J New OK
\ r Ctrl-M ENTER
\ t Ctrl-I tab key
\ v Ctrl-X horizontal tab
CHAR1-CHAR2: characters range from CHAR1 to CHAR2 specified, the specified range in the order of ASCII code basis, only from small to big, not descending.
[CHAR *]: This is a specific setting up SET2 function specified character to repeat the same length as the SET1
[CHAR * REPEAT]: This is set SET2 specific function is repeated to set the designated character REPEAT cycles before (the REPEAT digital mining 8 binary system computations to 0 as the start)
[: alnum:]: all the alphabetic characters and numbers
[: alpha:]: all alphabetic characters
[: blank:]: all horizontal spaces
[: cntrl: ]: all control characters
[: digit for:]: All figures
[: Graph:]: all printable characters (without spaces)
[: Lower:]: all lowercase letters
[: Print:]: all printable characters (including spaces)
[: punct:]: All punctuation characters
[: space:]: all horizontal and vertical spaces
[: upper:]: all uppercase letters
[: xdigit:]: all 16 digital binary system
[= CHAR =]: all (equal sign character in the CHAR, on your behalf customizable) comply with the specified character

 

find
grammatical
find path -option] [[-print -exec -ok | xargs | grep] [command {} \;]

-name filename # find a file called filename
-perm # by executing authority to find
-user username # by file owner to find
-group groupname # in groups to find
-mtime -n + n # by file to change the time to find the file , -n refers to within n days, + n n refers days ago
-atime -n + n # by file access times to find the file, -n refers to within n days, + n n refers days ago
-ctime -n + n # press file creation time to find the file, -n refers to within n days, + n n refers days ago
-nogroup # check file without a valid genus group is a group that is not present in the file / etc / groups in
-nouser # no effective investigation owner of the file owner, document in the / etc / passwd does not exist
-type b / d / c / p / l / f # search block device, directory, character devices, pipes, symbolic links, Trivial file
- size n [c] # search block length n [n bytes or] file
-mount # file does not check the time span Filesystem mount point
-follow # If you encounter a symbolic link file, follow links within the meaning of file
-prune # ignore a directory


wc
grammar
wc [-clw] [- help] [- version] [ file ...]

-c or --bytes or --chars show only a few Bytes.
-l or --lines show only the number of rows.
-w or --words display only words.
--help online help.
--version display version information.

 

unip
grammar
uniq [options] file

- c display output, plus the number of each line in the Bank appear in the file. It can be substituted - u and - d options.
- d show only duplicate rows.
- u display only files do not duplicate each row.
- n the first n fields are ignored with the blank in front of each field. Field is a string of a non-space, non-tabs, and tabs from one another separated by a space (fields numbered starting from 0).
before + n n characters are ignored, it is skipped before characters (character numbered from 0).
- fn and - the same as n, where n is the number of fields.
- sn + n and the same, where n is the number of characters.

Guess you like

Origin www.cnblogs.com/jiazilongBlog/p/11348286.html