Operating System - HP-UX
1825007 Members
2857 Online
109678 Solutions
New Discussion

Re: csplit with /regex/-n

 
carlosa
Occasional Visitor

csplit with /regex/-n

Hello,

I have a script that I was running on a linux box that I had to move over to one of my hp-ux boxes.  Part of the script uses csplit with /regex/-n {*} as parameters and this is giving me grief.  I tested it using /regex/ {*} and /regex/+n {*} and this acted as expected, but /regex/-n {*} did not.

An example file is:

a
b
1
dog
c
d
2
dog
e
f
g
3
dog
h
i
j


The command is like csplit -s filex /dog/-1 {*}. The expected result is, and this is what I got on linux:
xx00
a
b

xx01
1
dog
c
d

xx02
2
dog
e
f
g

xx03
3
dog
h
i
j


However, this command gives me the error "reached limit on number of output files at arg {*}".  If I instead use {n}, the xx00 file is as expected, however xx01 to xxNN is blank and xxN+1 has the remainder of the file.
I am using 11.31.
Any help is greatly appreciated.
Thank you.

2 REPLIES 2
RJHall
Frequent Advisor

Re: csplit with /regex/-n

csplit hasn't been patched on HP-UX 11.31 since 2009 (PHCO_39227). Possibly the Linux version has a fix that the HP-UX version doesn't?

Dennis Handly
Acclaimed Contributor

Re: csplit with /regex/-n

>Possibly the Linux version has a fix that the HP-UX version doesn't?

 

Most likely that gnu version never had the bug.  Mine is: csplit (GNU coreutils) 8.5

 

I would suggest the OP contact Support and file a bug.