A, diff
Use the diff command:
vimdiff command
contents of the file are as follows wang
contents of the file are as follows wang1
contrast with two diff command file
content changes in the file wang
again compare two files
results therefore use the diff command comparison of the two files displayed meaning contains different characters in the following table
character | meaning |
---|---|
The results in the first number numb1 | The number of lines of the first file |
a | Add to |
d | delete |
c | change |
< | The first file |
> | The second file |
After a, d, c contact numbers numb2 | The number of rows of the second file |
diff parameters commonly used
when two files shown below, there are two spaces in Document 2, consistent with the rest
-b: space indicates not detected
parameters -c: show all the contents of the file and identify the different
parameters -i: Ignore sensitive detection
parameters -r: detecting a directory
parameters -u: combined output
Two, patch
Usage: patch the original file patch file
patch and diff -u in combination with
patch
common parameters -b: Backup the original file
Three, cut
typically cut command to intercept the data
common parameters are as follows:
parameter | meaning |
---|---|
-d | Specify the delimiter |
-f | Specifies the lie displayed |
-c | The interception of a specified character |
Specifies that the column then use numbers or characters
Digital format | meaning |
---|---|
3 | Selected in the third column |
3,5 | Selected third and fifth columns |
3-5 | Selected third column to the fifth column |
-3 | From the beginning to the third column |
3- | The third column from the beginning to the end |
Four, sort
Requirements can achieve the sort of
common parameters are as follows:
parameter | meaning |
---|---|
-n | Sort pure digital |
-r | Reverse order |
-u | Remove duplicate |
-The | Output to the specified file |
-t | Specify the delimiter |
-k | Specify the sort sequence |
Write the following numbers in a file
sort order and combination uniq
uniq command parameters used in the following table
parameter | meaning |
---|---|
-c | The combined number of repeat and statistics |
-d | Display duplicate rows |
-u | Show only line |
Five, tr
tr command is mainly used to change the character of the case
Six, test
In the script, [] the equivalent of the test command
Comparative figures in the 6.1 test
parameter | meaning |
---|---|
= | equal |
!= | not equal to |
-eq | equal |
-born | not equal to |
-the | Less than or equal |
-lt | Less than |
-give | greater or equal to |
-gt | more than the |
6.2 test conditions in relation
parameter | meaning |
---|---|
-a | and |
-The | or |
6.3 test for an empty judgment in
parameter | meaning |
---|---|
-n | Detection is not empty |
-from | Detection is empty |
6.4 test for determination of file
parameter | meaning |
---|---|
-if | If the file node number is consistent, one file to another file hard link |
-nt | File 1 File 2 is not better than new |
-ot | File 1 File 2 is not better than the old |
-d | table of Contents |
-S | Sockets |
-L | Soft links |
-e | Detect the presence |
-f | Trivial File |
-b | Block device |
-c | Character device |