Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 txt 文件目录可以放入另一个文件。但是我需要在每个文件的内容之前放一个标题。具体来说,我想做这样的事情:
---------------- <FILENAME> ---------------- content ---------------- <FILENAME2> --------------- content
实际上我不需要文件名前后的所有“------------”,但这会很好。
感谢您的时间 ;)
for f in *.txt; do echo "----------------<$f>----------------"; cat "$f"; done >> OUTPUT_FILE