cut
Check file contents
Designated portion of the display line, delete the files in the specified field
Display file contents, similar in type command.
grammar:
cut (option) (parameters)
Options:
-b: specified line range to display only content directly;
-c: character range designated display line only;
-d: Specifies the field separator, the default field delimiter is "TAB";
-f: display the contents of the specified field;
-n: the "-b" option is used in conjunction, not split multi-byte character;
--complement: byte complement is selected, a character or a field;
--out-delimiter = <field delimiter>: specifies the output content of the field delimiter;
--help: display help information instruction;
--version: show the version information of the instruction.
parameter:
File: Specifies the content filtering file
==================================================================================
xargs
Alternatively xargs tool used to read the input data output after reformatting.
Define a test file, contain a number of lines of text data:
cat test.txt
a b c d e f g
h i j k l m n
o p q
r s t
u v w x y z
Enter single multi-line output:
cat test.txt | xargs
a b c d e f g h i j k l m n o p q r s t u v w x y z
-n option multi-line output:
cat test.txt | xargs -n3
a b c
d e f
g h i
j k l
m n o
p q r
s t u
v w x
yz
-d option can customize a delimiter:
echo "nameXnameXnameXname" | xargs -dX
name name name name
Combined with the -n option to use:
echo "nameXnameXnameXname" | xargs -dX -n2
name name
name name
xargs an option -I , using -I {} specify a replacement string, the string may be extended when xargs replaced, when used in conjunction xargs -I with each parameter command is executed once:
cat arg.txt | xargs -I {} ./sk.sh -p {} -l
-p aaa -l
bbb -l -p
-p ccc -l
Copy all picture files to the next / data / images directory:
ls *.jpg | xargs -n1 -I cp {} /data/images
=====================================================================================
sort
sort command is to help us sort based on different data types, its grammar and common parameter format:
sort [-bcfMnrtk] [source] [- o Output File]
Sort for the content may be a text file, in units of sorted.
Parameters:
-b ignore the space character in front of each line start out.
-c Check whether the file has been sorted in the order.
When -f sort ignore uppercase and lowercase letters.
-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.
-k choose which section to sort.
==========================================================================
TR
TR [option] ... set 1 [Set 2]
Options:
-c, -C, -complement replaced with a collection of strings of a required character set is ASCII.
-d, -delete delete the collection of characters instead of converting 1
-s, -squeeze-repeats delete all repeated sequences of characters, retaining only the first; soon repeated string compressed into a string.
-t, -truncate-set1 delete characters in the first character set than the second character set extra
Collection of a range of characters:
\ NNN NNN character octal value (1 to 3 octal value of the character)
\\ backslash
\ A Ctrl-G ringtones
\ B Ctrl-H backspace
\ F Ctrl-L Traveling feed
\ N Ctrl-J new line
\ R Ctrl-M Enter
\t Ctrl-I tab键
\ V Ctrl-X horizontal tab
CHAR1-CHAR2 CHAR1 to all the characters from the ASCII character CHAR2 order in accordance with
[CHAR*] in SET2, copies of CHAR until length of SET1
[CHAR*REPEAT] REPEAT copies of CHAR, REPEAT octal if starting with 0
[: Alnum:] All letters and numbers
[: Alpha:] all letters
[: Blank:] horizontal tab, blank, etc.
[: Cntrl:] all control characters
[: Digit:] All figures
[: Graph:] all printable characters, not including spaces
[: Lower:] all lowercase characters
[: Print:] all printable characters, including spaces
[: Punct:] All punctuation characters
[: Space:] of all the horizontal or vertical blank
[: Upper:] all capital letters
=========================================================================
rename
Parameters :
-v said they would show modified successfully file name;
-n indicates no operation is performed, it is used to test rename process, does not directly run, the test results can be viewed, and then run;
-f indicated that it would force the changes.
Uppercase file name all lowercase was:
rename 'y/A-Z/a-z/' *
The * .JPG renamed as * .jpg you can use:
rename *.JPG *.jpg