GNU bug report logs -
#8796
I need help piping csplit
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8796 in the body.
You can then email your comments to 8796 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#8796
; Package
coreutils
.
(Fri, 03 Jun 2011 19:51:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Julio Cesar Gonzalez Torres <bettlebog <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Fri, 03 Jun 2011 19:51:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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 //
|_ |_*
*
[Message part 2 (text/html, inline)]
Reply sent
to
Eric Blake <eblake <at> redhat.com>
:
You have taken responsibility.
(Fri, 03 Jun 2011 21:45:03 GMT)
Full text and
rfc822 format available.
Notification sent
to
Julio Cesar Gonzalez Torres <bettlebog <at> gmail.com>
:
bug acknowledged by developer.
(Fri, 03 Jun 2011 21:45:03 GMT)
Full text and
rfc822 format available.
Message #10 received at 8796-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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 eblake <at> redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#8796
; Package
coreutils
.
(Fri, 03 Jun 2011 22:29:01 GMT)
Full text and
rfc822 format available.
Message #13 received at 8796 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 06/03/2011 03:44 PM, Eric Blake wrote:
> 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'/
Or, ditch xargs altogether, and do it all through find:
find . -name '*out' -exec csplit {} "/All Frequencies/" /Statistical/ \;
which has the added benefit of avoiding problems with any *out files
that have embedded newlines.
--
Eric Blake eblake <at> redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 02 Jul 2011 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 13 years and 361 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.