使用cat
输出指定目录下的*.txt
文件,如何在每个文件前插入文件名作为“break”?
file #1
contents of file
file #2
contents of file
理想情况下是一些易于内存的 bash
命令。
另见:
最佳答案
@0stone0 回答的另一个选项
您可以使用 tail
代替 cat:
tail -n +1 *
输出:
==> file-1.txt <==
contents of file
==> file-2.txt <==
contents of file
关于linux - 如何使用 xargs 将 ls 通过管道传输到 cat 中,以便列出文件名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65217910/