Prompt> find ./ -maxdepth 1 -name "IN-Pass-30*" | wc -l
// find all files inside that directory without checking subdirectories.
// once they are found, count them.
Prompt> cat IN-Pass-30* | wc -l
// use `cat` to concatenate all files' content.
// at the end, count the amount of lines.
Prompt> echo $$(a - b))
// calculate the difference between a and b.
Prompt> echo $(command)
// show (or do whatever with it) the result of a command
2条答案
按热度按时间z9smfwbn1#
您已经很接近了。将sed命令封装在bash glob循环中:
2skhul332#
我提出以下“简单”的解决方案:
这是什么意思?
哦,整个想法是每个文件一个标题占一行,所以通过计算所有文件中的行数,减去文件数(与标题行数相同),应该得到所需的结果。