tr命令
# tr 'a-z' 'A-Z' < /etc/fstab
#
# /ETC/FSTAB
# CREATED BY ANACONDA ON THU AUG 14 21:16:42 2014
#
# ACCESSIBLE FILESYSTEMS, BY REFERENCE, ARE MAINTAINED UNDER '/DEV/DISK'
# SEE MAN PAGES FSTAB(5), FINDFS(8), MOUNT(8) AND/OR BLKID(8) FOR MORE INFO
#
UUID=94E4E384-0ACE-437F-BC96-057DD64F42EE / EXT4 DEFAULTS,BARRIER=0 1 1
TMPFS /DEV/SHM TMPFS DEFAULTS 0 0
DEVPTS /DEV/PTS DEVPTS GID=5,MODE=620 0 0
SYSFS /SYS SYSFS DEFAULTS 0 0
PROC /PROC PROC DEFAULTS 0 0
/SWAPFILE SWAP SWAP DEFAULTS 0 0
tee命令
# cat /etc/passwd | head -5 | tr 'a-z' 'A-Z' | tee test/1.txt
ROOT:X:0:0:ROOT:/ROOT:/BIN/BASH
BIN:X:1:1:BIN:/BIN:/SBIN/NOLOGIN
DAEMON:X:2:2:DAEMON:/SBIN:/SBIN/NOLOGIN
ADM:X:3:4:ADM:/VAR/ADM:/SBIN/NOLOGIN
LP:X:4:7:LP:/VAR/SPOOL/LPD:/SBIN/NOLOGIN
wc命令
# wc -l 1.txt
5 1.txt
# cat 1.txt
ROOT:X:0:0:ROOT:/ROOT:/BIN/BASH
BIN:X:1:1:BIN:/BIN:/SBIN/NOLOGIN
DAEMON:X:2:2:DAEMON:/SBIN:/SBIN/NOLOGIN
ADM:X:3:4:ADM:/VAR/ADM:/SBIN/NOLOGIN
LP:X:4:7:LP:/VAR/SPOOL/LPD:/SBIN/NOLOGIN
cut命令
# cat 1.txt | cut -d: -f 1
ROOT
BIN
DAEMON
ADM
LP
sort命令
# cat 1.txt | cut -d: -f 1-3 | sort
ADM:X:3
BIN:X:1
DAEMON:X:2
LP:X:4
ROOT:X:0
uniq命令
# sort 1.txt
111
111
222
333
333
444
444
555
666
777
888
sort 1.txt | uniq -c
2 111
1 222
2 333
2 444
1 555
1 666
1 777
1 888