Combine (cat) all files in a tar.gz file
Hi,
Sorry if this is a an easy question but its go me beat at the mo after lots of trying. I have a test.tar.gz file that contains 100 csv files. I'm trying to work out how to unzip and extract all the files and cat them all together into 1 single csv file in one or possibly 2 commands...and leaving me with just the one csv file as the output...not all the extracted ones as well/ I *think* i need something like: tar -xvf test.tar.gz | cat *.csv > singlefile.csv but obviously this isn't correct . I've played around for ages now with lots of variations and using "-" as well but the best I managed was to extract all the files AND create the singlefile as well....when what i need as the only output is a singlecsv file that contains all the lines within the 100 csv files. Many thanks for any help or pointers. Mike |
Assuming everything goes well try:
Code:
tar -O -xf test.tar.gz > singlefile.csv |
Code:
tar xvf myfiles.tar.gz -O > bar edit: ...and I see that metaschima posted while I was typing! beat me to it. |
Ahhh!!! -O Thank you so much.....works perfectly....and very elegant!
Mike |
All times are GMT -5. The time now is 03:37 PM. |