On Friday 24 March 2006 15:36, Boyd Stephen Smith Jr. wrote: > > > Michael Kintzios wrote: > > > > what I think is needed > > > > here is untarring of the archive, while untarred data is > > > > dynamically deleted immediately after untarred to make space for > > > > more data to be untarred . . . do I make sense? > > > > > > Yes, but GNU tar cannot do that, it can only do one command at a > > > time, either --extract or --delete or ... > > > > Yes, that's why I was hoping that some clever bash-ery may be able to > > pipe the lot together. > > Perhaps: > tar xvf gentoo_usr.tar | while read file; do tar --delete f gentoo_usr.tar > "$file"; done > > That might just screw up your tar file and/or extract junk; I didn't test > it at all.
ROFL. No that won't work. ;) You cannot delete while extracting and when extraction is completed there is no point. This, however, does work: tar tf gentoo_usr.tar | sort -r | while read file; do tar -xf gentoo_usr.tar "$file" && tar --delete -f gentoo_usr.tar "$file"; done First of all the dash before f when deleting is necessary. That's just syntax. Secondly the sort -r is VERY important to make sure it extracts the deepest files (in terms of path) first then deletes them. Both -x and --delete or recursive by default. The problem with this, however, is that it only works with a tar file. Apparently it is not possible to delete a file from a compressed tar file. -- Bo Andresen -- gentoo-user@gentoo.org mailing list