I have a compressed tar archive and I want to extract one file from deep in the archive to the current working directory.
Is there something better than tar, or a way to extract it without the directory components?
I'm doing something like this right now:
tar xfvz $file -C $destination $folder"/"$file
cd $destination"/"$folder
mv $file ../$file
rm -r $folder
But I sometimes delete the wrong $folder.
For example, my archive is : mytar.tar.gz.
Inside it I have myfolder/mysecondfolder/hello.txt.
I want to extract myfolder/mysecondfolder/hello.txt as hello.txt in the current directory.
Just give the full stored path of the file after the tarball name.
Example: suppose you want file
test.tar.gzfrom2.pdf:tar -zxvf test.tar.gz 2.pdf