[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: input/output redirection with tar
From: |
e-letter |
Subject: |
Re: input/output redirection with tar |
Date: |
Thu, 20 Oct 2011 19:10:15 +0100 |
>> Readers,
>>
>> I tried without success the following command syntax
>>
>> tar --extract --file=/path/to/tarball< /path/to/list/of/files.txt
>
> Your question is about tar and/or the shell, neither of which are part
> of coreutils. You may have better results by asking your question on a
> more appropriate list. That said...
>
Sorry; I have not read farther than the first paragraph of the home
page; in retrospect I suppose appropriate mailing lists should be
those for 'bash' and 'tar'.
>> Is there a reason why redirect does not work with tar command?
>
> If you want the contents of files.txt to be passed as command line
> arguments, then you need to use command substitution, not file redirection:
>
> tar --extract --file=/path/to/tarball $(cat /path/to/list/of/files.txt)
>
Thanks; for the benefit of other novices, information about 'command
substitution' is in the manual 'bash reference manual'.
>
> Or if you insist on using redirection, then use '-' as the --files-from
> argument to tell tar to read from stdin:
>
> tar --extract --file=/path/to/tarball --files-from=-
> </path/to/list/of/files.txt
Please, from where did you get the information about the use of the
dash (-) character in this context?