您的位置:首页 > 运维架构 > Linux

the diary for one command application of pipe in Linux

2017-04-15 21:46 555 查看
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!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐