tag 8796 notabug
close 8796
thanks

On 06/03/2011 01:46 PM, Julio Cesar Gonzalez Torres wrote:
> Hi I have an issue, I'm trying to split several files into two the first one
> is the head of file and the next one has to start with some title, but
> csplit don't allowe me to piping, this is how i'm doing
> 
> $> find ./ -name '*out' | xargs csplit '/All Frequencies/' '/Statistical/'
> 
> I have to now all the locations of files that ends with "out", next every
> time the command finds a file I want to csplited but terminal sends me an
> error:
> 
> csplit: cannot be open «/Statistical/» to read: file or extension don't
> exist--

Thanks for the report.  However, this is not a bug in coreutils, but in
your usage of xargs.  So I'm marking it closed.

It helps to insert 'echo' prior to 'csplit' to see what you are calling:

csplit '/All Frequencies/' '/Statistical/' file1out file2out ...out

But csplit is documented as requiring a single file name, followed by
multiple patterns.

What you WANT to do is:

find . -name '*out' | \
  xargs -I{} csplit {} '/All Frequencies/' '/Statistical'/

The use of -I{} forces xargs to use one file per csplit invocation
(instead of cramming in as many files as possible), as well as to let
you choose where to substitute the file name 9rather than cramming it on
as the last argument).

-- 
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to