2018-6-1 笔记
8.10 shell特殊符 cut命令
命令前加# 命令不生效
\ 脱义字符
管道符
cut 截取字符串
# cat /etc/passwd | cut
8.11 sort_wc_uniq 命令
sort 排序
# sort /etc/passwd 默认以字母排序(阿斯玛??)
#sort -n 以数字进行排序,其他字符默认为零,排在前边
#sort -nr 反序排序
wc -l 统计行数
wc-m 统计字符数,包括换行符
wc -w 统计词数,以空白符作为分割
uniq 去重复
发现uniq之后没有变化,因为需要先排序
统计重复次数
8.12 tee_tr_split命令
tee与>类似,重定向的同时还在屏幕上显示
# sort 2.txt |uniq -c |tee a.txt
# sort 2.txt |uniq -c |tee -a a.txt 追加
tr 替换字符
# echo “aminglinux” |tr‘[al]‘ ‘[AL]‘将字符串aminglinux的a和l更换为大写
# split -b 100 +文件名 指定文件切割大小,不指定单位默认单位为字节
# split -l 100 +文件名 指定切割行数
同时指定大小,名字