Problem with csplit .....

Paul Jackson pj at giraffe.asd.sgi.com
Tue Oct 2 11:03:42 AEST 1990


In article <218*finn.drablos at sintef.no>, finn.drablos at sintef.no (Finn Drablos) writes:
|> I have a source code file with several subroutines. Each subroutine is
|> started with a comment line with 'BEGIN <name-of-routine>'.
|> 
|> Now I want to split this into separate files with csplit, and as I
|> understand the man page the following command should work :
|> 
|> csplit -k source.src /BEGIN/ {40}
|> 
|> However, it seems to split up to the first BEGIN, and then the next 40
|> lines. It does not use the pattern 40 times. I have tried /BEGIN/{40},
|> '/BEGIN/ {40}', '/BEGIN/{40}', '/BEGIN/+0 {40}', '/BEGIN/+0{40}',
|> '/BEGIN/'{40} etc. ...

The csh strips off the unquoted { } characters, so that the actual
argument seen by csplit is a simple 40, which is taken as a line number.

Try:
	csplit -k source.src /BEGIN/ '{40}'

where the single quotes protect the { } characters.
Your other attempts mostly tried to force the /BEGIN/ and the {40}
into a single argument, which is not what you want.

-- 

				Thanks, take care ...
				Paul Jackson (pj at asd.sgi.com), x1373



More information about the Comp.sys.sgi mailing list