How do I delete a single file from a tar.gz archive
You can repackage it like this:
tar -czvf ./new.tar.gz --exclude='._*' @old.tar.gz
I used ._*
to remove all ._files
, but you can use any pattern you like, including a full path, directory, filename, or whatever.
As mentioned in the comments it's not possible to remove the file using tar, but you can exclude the file when extracting:
tar -zxvf file.tar.gz --exclude "file_to_exclude"