I'm quite new to scripting so I appreciate any help. I have a text file that in some cases can be quite long, each section of text lines can be around 6/7 lines long. It is a logfile and each section starts with the word timestamp. There is a blank line between each section of lines. Each section line ends with a semi-colon.
timestamp=201706291035.....;
line 2;
line 3;
line 4;
line 5;
line 6;
line 7;
timestamp=201706291038.....;
line 2;
line 3;
line 4;
line 5;
line 6;
I need to be able to extract each section out to another text file in a single line. Preferably without the last semi-colon.
timestamp=201706291035.....;line 2;line 3;line 4;line 5;line 6;line 7
timestamp=201706291038.....;line 2;line 3;line 4;line 5;line 6
Is that enough information for a solution?
Here's a direct example:
timestamp=2017-06-28-01.01.35.080576;
event status=0;
userid=user1;
authid=user1;
application id=10.10.10.10.11111.12345678901;
application name=GUI;
timestamp=2017-06-28-01.01.36.096486;
event status=0;
userid=user1;
authid=user1;
application id=10.10.10.10.11111.12345678901;
application name=GUI;
statement text=SELECT table.field, table.field, table.field from database where table.field = value
After I run the scripts @steeldriver, the source and destination file looks the same.