help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

requesting csplit help


From: Gerald . Hasty
Subject: requesting csplit help
Date: 22 Oct 2006 14:21:15 -0700
User-agent: G2/1.0

Dear Gnu.Utils,

I have some large files of the form shown below between "======" lines.
 Internal blank lines occur in there that I would like to use as a
csplit delimiter.  However, I cannot figure out what to use for that
purpose.

The text blocks above and below the blank lines can be dozens to
hundreds of consecutive text lines, and there are hundreds of
intervening blank lines per file.

The blank lines are the result of pre-processing by a Perl script.  The
script removes all but the remaining text lines by executing
substitution via "s/matching_expression//;" and then creating the files
with "print if ! /^$/../^$/;".

========
ASCII text
ASCII text

ASCII text
ASCII text

ASCII text
ASCII text

ASCII text
ASCII text

========

I would like to get in the output files that consist of the blocks of
text.

If csplit (via GnuWin32) isn't the best route for this, I'll try
another way, but if csplit will work it will be preferred for now.
Among the things I've tried:
\n
\r
\r\n
\n\r
[:blank:]

For example, if I use this on the example above

> csplit sample.out /[:space:]/ {*}

I get the following (between "++++++") in output files xx01, xx03,
xx05, xx07

++++++
ASCII text
++++++

and the following in output files xx02, xx04, xx06, xx08

++++++
ASCII text

++++++

If I use "blank" or any of the other tried expressions in place of
"space", I get a an output file identical to the input file.

Gerald



reply via email to

[Prev in Thread] Current Thread [Next in Thread]