gzpk

03 2015 档案

一些简单的错误
摘要:1) 我们打算把文件夹test里面的内容打包成tar包test.tarcd test && tar -cvf test.tar *若test中无文件,上面脚本命令将报错。2) 同时输出到屏幕和重定向使用tee例如:echo “1000000000” | tee a.txt3) 在windows下修改... 阅读全文

posted @ 2015-03-25 13:48 gzpk 阅读(120) 评论(0) 推荐(0)

grep 相关
摘要:1) -q 参数,本意是 Quiet; do not write anything to standard output. Exit immediately with zero status if any match is found, even if an error was detected. ... 阅读全文

posted @ 2015-03-11 10:25 gzpk 阅读(180) 评论(0) 推荐(0)

字符串排序去重
摘要:有一个字符串:a="190.0.1 190.0.2 190.0.1"现在我要对其去重,去重可以用uniq,可是前提是先要排序,以下是实现:a=`echo $a | awk '{for (i=1; i<=NF; i++) print $i}' | sort |uniq`echo $a190.0.1 1... 阅读全文

posted @ 2015-03-05 17:16 gzpk 阅读(424) 评论(0) 推荐(0)

echo 换行不换行
摘要:echo换行输出需要转义符 -e看以下例子:1 echo -e "It is the first line." >> a; echo -e "It is the second line.\c" >> a; echo -e "It is the third line." >> a; echo -e "... 阅读全文

posted @ 2015-03-04 11:33 gzpk 阅读(13787) 评论(0) 推荐(0)

导航