SHELL-tnd
五周第五次课(9月1日)8.10 shell特殊符号cut命令
8.11 sort_wc_uniq命令
8.12 tee_tr_split命令
8.13 shell特殊符号下
相关测验题目:http://ask.apelearn.com/question/5437
8.10 shell特殊符号cut命令
cut -d"指定分隔符" -f1,2 截取第几段
8.11 sort_wc_uniq命令
sort排序默认按照ASII码排序。
sort -n以数字排序。字母和特殊符号被认为是0,所以会排在前面
sort -rn 反序
sort -t可以指定分隔符,可以指定走那段分割来排序。
wc -l统计行数
wc-m统计字符数,结尾换行符也会被计入在内
wc-w统计词的个数。
uniq去重复的。一般要和sort结合起来用
sort -n | uniq
8.12 tee_tr_split命令
sort 1.txt | uniq -c | tee a.txt
把输出的内容输出到a.txt,并且把结果打印到屏幕上。!!!
sort 1.txt | uniq -c | tee -a a.txt
tee -a表示追加。
tr命令
echo "NiHao" | tr 'H' 'h'
echo "NiHao" | tr '' ''
split切割
-b
-l行
8.13 shell特殊符号下
多条命令写在一行,用分号分割。
&> 错误和正确全部重定向到一个文件中
&& 前面的命令成功才会执行后面的命令
页:
[1]