在文件test.txt中查找”hello”关键字以及前后5行的内容
1 | grep -C 5 "hello" test.txt |
搜索test.txt中含有关键字”hello”的行号
1 | grep -n "hello" test.txt |
查看test第13-15行
1 | sed -n '13,15p' test.txt |
统计当前文件夹下目录的个数
1 | ls -l|grep "^d"|wc -l |
统计文件夹下目录的个数,包括子文件夹里的
1 | ls -lR|grep "^d"|wc -l |
统计当前文件夹下文件的个数
1 | ls -l |grep "^-"|wc -l |
统计当前文件夹下文件的个数,包括子文件夹里的
1 | ls -lR|grep "^-"|wc -l |