如何获得"wc -l"只打印没有文件名的行数? [英] How to get "wc -l" to print just the number of lines without file name?
本文介绍了如何获得"wc -l"只打印没有文件名的行数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
wc -l file.txt
输出行数和文件名.
我只需要数字本身(而不是文件名).
I need just the number itself (not the file name).
我可以做到
wc -l file.txt | awk '{print $1}'
但是也许有更好的方法?
But maybe there is a better way?
推荐答案
尝试这种方式:
wc -l < file.txt
这篇关于如何获得"wc -l"只打印没有文件名的行数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文