Re: Piping required files through tar

From: Chris F.A. Johnson (c.fa.johnson_at_rogers.com)
Date: 01/23/04


Date: 23 Jan 2004 18:57:29 GMT

On Fri, 23 Jan 2004 at 16:15 GMT, Doug Freyburger wrote:
> Ed wrote:
>>
>> I have a tar file containing a dir called Jan04
>> In that dir are sub dirs called Spools Bank and Logs
>> I want to extract a file called 00012234.spl from Spool without
>> extracting the whole dir structure
>
> tar tf foo.tar | grep Jan04 | grep "Spools Banks and Logs" | grep 00012234.spl > wow
>
> tar xvf foo.tar ` cat wow `
>
> No need for all of those greps in a row if you're certain of the exact
> path. I just broke it up in case there are a bunch of intervening
> layers of directories.

   No need for more than one grep (unless yours is a very old grep):

tar tf foo.tar | grep -e Jan04 -e "Spools Banks and Logs" -e 00012234.spl > wow

-- 
    Chris F.A. Johnson                        http://cfaj.freeshell.org
    ===================================================================
    My code (if any) in this post is copyright 2004, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License


Relevant Pages

  • Re: Piping required files through tar
    ... > I have a tar file containing a dir called Jan04 ... > In that dir are sub dirs called Spools Bank and Logs ... Some tars have a flag to strip a path from the output filenames (Eg on ... Another approach is to use pax to extract the archive, ...
    (comp.unix.admin)
  • Re: Piping required files through tar
    ... > I have a tar file containing a dir called Jan04 ... > In that dir are sub dirs called Spools Bank and Logs ... > I want to extract a file called 00012234.spl from Spool without ...
    (comp.unix.admin)
  • Re: Piping required files through tar
    ... > I have a tar file containing a dir called Jan04 ... > In that dir are sub dirs called Spools Bank and Logs ... > I want to extract a file called 00012234.spl from Spool without ...
    (comp.unix.admin)
  • Piping required files through tar
    ... I have a tar file containing a dir called Jan04 ... In that dir are sub dirs called Spools Bank and Logs ... I want to extract a file called 00012234.spl from Spool without ...
    (comp.unix.admin)
  • Re: The argument for fs assistance in handling archives
    ... |>Suppose I've got a tar file with an index attached. ... |>have to figure out exactly which ones I need before I extract them ... | This doesn't justify bloating the kernel. ... | Are you saying install it on demand the first time it's run? ...
    (Linux-Kernel)