pGNW
pGNW

Reputation: 1

Trouble using csplit to split a text file based on delimiter

I have a text file containing multiple chunks of texts. In between each chunk, I've inserted the string '######## START OF NEW ARTICLE ########'. I'm trying to split the file at each of those instances using csplit in order to get separate files, each containing a unique chunk of text.

This is what I'm running through the terminal:

csplit -f check -n 3 desktop/TEST/test.txt ‘######## START OF NEW ARTICLE ########’ {*}

I get the error: csplit: ‘########: unrecognised pattern

What am I doing wrong?

Upvotes: 0

Views: 484

Answers (1)

David Welch
David Welch

Reputation: 46

You need to enclose the regex pattern in // e.g. ‘/######## START OF NEW ARTICLE ########/’.

Upvotes: 0

Related Questions