so i have hundreds of files named history.20071112.tar
(history.YYYYMMDD.tar)
and im looking to extract one file out of each archive called status_YYYYMMDDHH:MM.lis
here is what i have so far:
for FILE in `cat dirlist`
do
tar xvf $FILE ./status_*
done
dirlist is a text containg the full path to the tar files i want to extract the single file from:
/export/home/psxfer/history/archive/history.20070101.tar
/export/home/psxfer/history/archive/history.20070102.tar
/export/home/psxfer/history/archive/history.20070103.tar
/export/home/psxfer/history/archive/history.20070104.tar
/export/home/psxfer/history/archive/history.20070105.tar
etc...
the problem is that it doesnt look like tar is liking the wildcard and needs the exact file name of the single file to extract so it's not working.
anyone have any ideas? or would i need to run tar -tf history.YYYYMMDD.tar for each file to get the exact filename for the .lis file?
thanks in advance!!
i forgot to mention that this is solaris 8 if that makes a difference.
Well, this *should* work. There are caveats, tho. First, the pattern should be quoted, since it will be expanded by the shell if it matches any files in the current directory. Second, the filename must match precisely, path and all. Are you sure the file is stored in the archive as "./foo.bar" ?
Curious, I didn't have a problem extracting from tar via wildcards on OSX (it was the nearest Unix machine). I guess you'll need to extract the name first, as you already suggested, although it means scanning each archive twice (arrrrrg).