I am concatenating thousands of .txt files together but I want to keep the path written above the text of each .txt file so I can refer back to the directory to review files if needed.
Example:
file1.txt has the following content:
id: 1234
info: 1234
id: abcd
info: abcd
The path to file1.txt is pathto/dir1/sub1/file1.txt
file2.txt has the following content:
id: 5678
info: 5678
The path to file2.txt is pathto/dir2/sub2/file2.txt
The .txt file after concatenating should be formatted like:
pathto/dir1/sub1/file1.txt
id: 1234
info: 1234
id: abcd
info: abcd
pathto/dir2/sub2/file2.txt
id: 5678
info: 5678
Concatenating alone does not print the path in between each concatenated .txt file which is what I am trying to accomplish.
I will also cd ~/ into pathto/
and would need to run a command from there that will recursively scan all subdirectories looking for "file.txt" files
{ }
to preserve the formatting.