I have a concatenated log file with multiple logs inside that I'm trying to parse out into individual log files (I will later rename them to the date/time of each). Each log is separated by "--- LOG REPORT ---".
So far I have...
sed -n '/--- LOG REPORT ---/,/--- LOG REPORT ---/p' logname.log > test.out
However, as you can imagine, that only outputs the first instance of the pattern. I looked over the man page for sed and I'm not convinced it can output multiple files. Perhaps I could keep extracting from a file until it's empty but that seems like too much work. How I can achieve this? Maybe I should be using awk instead?
Example of input file filename.log
--- LOG REPORT --- Mary Had A Little Lamb --- LOG REPORT --- Her Fleece Was White As Snow
--- LOG REPORT --- Mary Had A Little Lamb
--- LOG REPORT --- Her Fleece Was White As Snow