the diary for one command application of pipe in Linux

  1. ls -l /projects/ghosttrail | tail -n +2 | sed 's/\s\s*/ /g' | cut -d ' ' -f 3 | sort | uniq -c

 actually in my first glance, i think it is complicated, and the true is that i got stopped when i see the third code of the program sed,i have forget waht is the \s meaning,when i figure it out and run each program separately, i understand this sentence.

the first part "ls -l ......" is to list the detailed files information within the specified directory;

the second part "tail -n +2" is to filter the result given from first part command to get result without total number of files;

the third part "sed 's/\s\s*/ /g" is to substitute white spaces with only one space';

the fourth part "cut -d ' ' -f 3" is to get the third filed data;

the fifth part " sort " is to sort result alphabetically;

the final part "uniq -c" is to add the repetition number of  every line result;

Learning is cool!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值