Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

For a while I've wanted to learn how to use csplit, so tonight I tried practicing. I created a file with some text, and where I wanted to split the text, I wrote two colons (::) surrounded by two newlines, so that they formed separate double-spaced paragraphs from the rest of the text. Then I invoked csplit thus:

$csplit filename /::/

I thought I had failed when I saw that the only thing printed to standard output was some numbers. But when I looked at the directory listing I realized I had partly succeeded. One bunch of text had been cut off from the rest, the top bit. I just needed csplit to notice the other places where I had put two colons. But I couldn't figure out how to do that. I thought it might be

$csplit filename /::/*/

but alas, that did not work.

Persuant to an answer below, I also tried

me@localhost:~/folder$ csplit story3.bkp /::/'{*}'

but I got

csplit: /::/{*}: integer expected after delimiter

so then i tried adding a space after /::/ -- which worked!

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

Are you looking for csplit file /::/ '{*}'?

share|improve this answer
    
'fraid no cigar. amended question to reflect. –  ixtmixilix Oct 9 '11 at 16:31
    
nevermind. i just figured it out -- there's a space in between / and ', which the se markup doesn't show well in my browser. thanks... –  ixtmixilix Oct 9 '11 at 16:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.