0

I have the following file content

testing with
---- ----
get footer

I want to split it with the ---- ---- . There may be some other content between the '----'. I am using the following, but it keeps telling that match not found.

csplit -f instruction $FILE /^[-]{4}[\s\S]*[-]{4}$/
Cyrus
  • 84,225
  • 14
  • 89
  • 153
coffeeak
  • 2,980
  • 7
  • 44
  • 87
  • 1
    See http://stackoverflow.com/a/18364586/3832970, it might help. Also, [csplit](http://pubs.opengroup.org/onlinepubs/009695399/utilities/csplit.html) accepts a BRE regex only, thus, you need something like `-\{4}.*-\{4}`. In POSIX regex, a dot matches any char incl. a newline, you do not need the `[\s\S]` like hacks. – Wiktor Stribiżew Aug 16 '16 at 07:35
  • The Perl regex extensions such as `\s` and `\S` should not be expected to exist in most regex dialects. It's not clear what you expect `[\s\S]` to match anyway -- if it worked, it would be synonymous to `.` (any character) as far as I can tell. – tripleee Aug 16 '16 at 07:37
  • Are you sure there is no trailing whitespace in the delimiting line? – Michael Vehrs Aug 16 '16 at 08:44

0 Answers0