[comp.sys.mips] tar bug???

haley@unmvax.cs.unm.edu (Timothy P. Haley) (01/05/91)

We have an RS2030 running Risc/OS 4.51.  We seem to be having trouble
using wildcards when extracting from tar archives.  For example
we have an archive file called stuff which has a bunch of files stored
in it with names of the form *.in along with *.logs and other files.
I wanted to extract only the .in files. So I typed ....

tar -xvf stuff "*.in"

Tar thought about it for a short time and then gave me my prompt back.
It didnt find any of the .in's.  So heres the question:  Is this not the
correct way to look for files in the tar file using wildcards? [If you dont 
quote the *.in the shell will try to expand it]  Or is this a bug or is 
wildcard matching like this not supported by tar.

Thanx,
Tim

Tim Haley                       haley@unmvax.cs.unm.edu
Part Time Grad Student
Full Time Worker Bee at Ball Systems
Sometimes confused.

mek@enterprise.udev.cdc.com (Mark Kennedy) (01/06/91)

In article <1991Jan4.165328.21000@unmvax.cs.unm.edu>,
haley@unmvax.cs.unm.edu (Timothy P. Haley) writes:
|> We have an RS2030 running Risc/OS 4.51.  We seem to be having trouble
|> using wildcards when extracting from tar archives.  For example
|> we have an archive file called stuff which has a bunch of files stored
|> in it with names of the form *.in along with *.logs and other files.
|> I wanted to extract only the .in files. So I typed ....
|> 
|> tar -xvf stuff "*.in"
|> 
|> Tar thought about it for a short time and then gave me my prompt back.
|> It didnt find any of the .in's.  So heres the question:  Is this not the
|> correct way to look for files in the tar file using wildcards? [If you dont 
|> quote the *.in the shell will try to expand it]  Or is this a bug or is 
|> wildcard matching like this not supported by tar.
|> 
 
Wildcard pattern matching is not supported by the tar command.  This is
not unique to Risc/OS, I have observed the same thing on SunOS 4.1.
There is a way around this however:

	tar xvf stuff `tar tf stuff|grep ".*in"`

This command will first list the table of contents of your tarfile, and
grep for only the files you are interested in.  Then a second tar is
executed which extracts what the first command returned.  Kludgy, maybe,
but effective.  If you have lots of big files, you may want to create
your tarfiles such that all related files are in separate tarfile archives
then this workaround will be unnecessary.

	-Mark

Mark Kennedy                     AT&T: (612) 482-2787
Control Data Corporation         E-Mail: mek@udev.cdc.com
	"Abandon all hope, ye who press enter here."