1
In the following directory structure:
directory1
-subdirectoryA
---fileA.txt
-subdirectoryB
---fileB.txt
subdirectoryC
---fileC.txt
I would like to generate a text file containing the following text concatenated:
name of subdirectoryA
-text contained within fileA.txt
name of subdirectoryB
-text contained within fileB.txt
name of subdirectoryC
-text contained within fileC.txt
I was able to use the following commands to get the contents of the text files concatenated, but information I need the directory name to organize the output:
find ./prefix_common_to_all_target_directories* -name "*.txt" -exec cat '{}' \; > concatenated_extracted_info.txt
thank you! this worked perfectly! Now I will figure out why ;) – goober grape – 2018-09-19T00:43:36.410
@goobergrape I've added an explanation and simplified the code. If my answer helped you I'd appreciate you accepting (the
✓
on the left) it. :) – confetti – 2018-09-19T08:07:48.7401Wow that's incredibly helpful and appreciated! Thank you for the explanation. I have checked the accept, thank you also for making me aware of this. Cheers! – goober grape – 2018-09-19T21:18:15.487