Subject: bug#8796: closed (Re: bug#8796: I need help piping csplit)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 03 Jun 2011 21:45:03 +0000

Your bug report

#8796: I need help piping csplit

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
8796: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8796
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#8796: I need help piping csplit
From: Eric Blake <[email-masked]>
To: Julio Cesar Gonzalez Torres <[email-masked]>
Cc: [email-masked]
Date: Fri, 03 Jun 2011 15:44:04 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

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   [email-masked]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Subject: I need help piping csplit
From: Julio Cesar Gonzalez Torres <[email-masked]>
To: [email-masked]
Date: Fri, 3 Jun 2011 14:46:26 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

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--
*
*_¬\_           ___________________________
 (  ¬¸>        || Julio César González Torres||
  |   \ »──   || UAM-Azcapotzalco  FAMA   ||
  | V()         ─────────────────────
  L  //
   |_ |_*
*