20.9 When a Program Doesn't Understand WildcardsWhen extracting files from a tar archive, it's handy to be able to use wildcards. You have to protect them ( 8.14 ) from the shell, so that they are passed directly to tar . However, in general tar don't understand wildcards. There's a terribly ugly hack that you can use to select the files you want anyway. Try a command like this:
What you're doing here is using tar twice. tar t will print the names of all the files on the tape. The pattern supplied to egrep ( 27.5 ) selects the pathnames containg lib/foo or lib/bar , and the resulting filenames are passed to the first tar command, which actually extracts the files from the archive. - |
|