0

I am using scplit to split a large file where the spitting pattern is --. My goal is to redirect all the splits into a pager rather than creating files. In the pager, I want to be able to watch one split at a time. The command to split the file turns out to be quite easy:

csplit -s --suppress-matched test.txt '/--/' '{*}'

But I do not know to to redirect the outputs to a pager. Is that possible?

Rubem Pacelli
  • 332
  • 2
  • 12
  • `csplit -s --suppress-matched test.txt '/--/' '{*}' | less` (or `|more`)? You may need `csplit ... 2>&1 | less`). OR I'm not understanding yourr prroblem. Doesn't `csplit` create files? Do you expect to see the contents of the files? Good luck. – shellter Jan 25 '23 at 19:49
  • @shellter "Doesn't csplit create files?" Yes, and I it not my goal. My goal is to redirect the splits to a pager rather than creating files – Rubem Pacelli Jan 25 '23 at 19:55
  • @shellter piping it to `less` I get an empty file and the files are created regardless.... – Rubem Pacelli Jan 25 '23 at 19:55
  • It's hard to understand why you want to do this. Are you experimenting, or do you have a real need. I you want to see your file in chunks, maybe somthing like `awk -v splitSz=100 '{if (!(NR % splitSz)) {print "\n\n"}1' myFilet | less` gives you what you want. This should put in 2 blank lines ever 100 lines of input, but print the complete contents of the file to the pager. Good luck. – shellter Jan 25 '23 at 20:08

0 Answers0