I have a big home directory, under which there are many jar files. I need to aggregate the contents of all txt files, within the jar files in my home directory, into a single text file.
Can someone help me with this? I don’t know how to write a script for this. I am using a Linux system.
To recap, I need to:
- Find all jar files
- Find all txt files within the jar files
- Get the contents of these txt files into a single output file
If we omit proper whitespace handling in file names, it boils down to:
You can also omit
| tail -n +3from the inner most loop if you wish to include the unzip header in the output file. An example header: