[shell]字符串处理

cut 

echo "x:xx:xxx" | cut -d ":" -f 2


uniq

cat file0 | sort | uniq


awk

echo "x:xx:xxx" | awk -F ":" '{for(i=1;i<=NF;i++) print $i}'


sed


sed -i 直接修改读取的文件

sed -i '/s/原字符串/新字符串/g' 1.txt

posted @ 2017-10-15 21:53  cn_wk  阅读(32)  评论(0)    收藏  举报