I'd like to print both everything before the 2nd line that begins with * i
(asterisk, space, lowercase letter I) excluding the line and everything after that line including the line separately.
For example, if I had a text file like this:
* misc: go to the park
with your dog
* important: sell badges
the bigger the pricier
24 left right now
* important: go to the mall
get clothes
* important: finish homework
I'd like to print this first:
* misc: go to the park
with your dog
* important: sell badges
the bigger the pricier
24 left right now
and then this:
* important: go to the mall
get clothes
* important: finish homework
How can I do this using sed?
I tried
sed '/\* [^i]/,$ { /\* [^i]/,$ d}' /path/to/txt/
but it just prints everything before the 1st matching line.
I'd like to have two separate scripts for extracting each part.