I have several thousand log files with date-time stamps in them that mark certain important events. Unfortunately the information that is recorded at any given date-time stamp sometimes has newline characters inserted so that the information is spread over several lines. In addition, there is other information that is irrelevant for my purposes that doesn’t have a date-time stamp.
I’ve got a perl one-liner that does the job of pulling the information that I want out:
perl -ne 'print if /^\d\d:\d\d:\d\d\.\d\d\d/..!/^\d\d:\d\d:\d\d\.\d\d\d/'
However, I want to remove the new line characters after the initial line (that contains the date-time stamp) and each of the following lines. However, I do want to keep the newline character after the very last line before the next line that starts with a date-time stamp.
I’m not having any luck on how to modify my one-liner to accomplish this.
1 Answer