WC calculates the number of lines , words , and bytes of a file
# wc/etc/passwd
1800/etc/passwd
# wc-l/ETC/PASSWD
40/etc/passwd
# wc-w/ETC/PASSWD
59/etc/passwd
# wc-c/ETC/PASSWD
1800/etc/passwd
grep Regular Introduction
^ Beginning of the line
$ End of line
V Take Back
n Display Line numbers
C Count Rows
diff compare two files to differences
d deleted (delete) -A added (append)-C changed (change )
CP/ETC/PASSWD PASSWD1
Delete a few lines and add a few lines to see the effect.
DIFF/ETC/PASSWD PASSWD1
Uniq to File Weight
Uniq-c file Displays the number of occurrences of duplicate rows in the file files count times
uniq-d file displays only duplicate rows, no duplicates are displayed
cut extracts files by column
- d indicates the column delimiter -F Select the output region -C to specify the character position
# cut-d:-F 1,7/etc/passwd |head-n 2
Root:/bin/bash
Bin:/sbin/nologin
# cut-c 1-3,6-9/etc/passwd |head-n 2
Substitution of tr characters for deletion
- d Delete
# tr-d: </etc/passwd |head-n 2
Replace
# TR ' ABC ' ABC ' </ETC/PASSWD |head-n 2
# TR ' abc ' A ' </etc/passwd |head-n 2
# tr ' A-Z ' A-Z ' </etc/passwd |head-n 2
sort sorted output
Sort By default in the order of the first character
- R Reverse order
-U Go Heavy
- n Sort by number
- t indicates that the delimiter is in conjunction with -K
- k Sort by specified field
# sort-t:-K 3/etc/passwd
Split split file split file named Xaa
-B (bytes) size
-L Number of rows
Linux Beginner Advanced file Management WC Uniq cut diff sort tr