I have some fairly large tarball archives, from which I need to extract some files. I will later repack those files to transfer them to another server. Currently that is a two (multi) step process for me:
mkdir ttmp tar -vxzf large.tgz -C ttmp/ --strip-components=<INT> <folder-to-be-extracted>
or alternatively with wildcards
mkdir ttmp tar -vxzf large.tgz -C ttmp/ --strip-components=<INT> \ --wildcards --no-anchored '*pattern*'
Then I go ahead and recompress the created folder
tar -vczf small.tgz ttmp/* rm -rf ttmp
How can I combine these two commands into one? Like this
tar -x large.tgz > tar -c small.tgz
Just to show, what I already tried:
Whenever I search the terms "extract" I will end up here or here or even here. When I use the term "split" I will end up here and that is definitely not what I intend to do. When I use "repack" I end up in strange places.