I am attempting to combine sections of log that should be one line but are spaced out over 10-30 lines due to how the software is outputting the info. (If I am making a newbie mistake I apologize)
Example of log I am working with:
2009-04-14 14:51:22 access data here
info.
Info.
Info.
��.. )}
2009-04-14 14:51:22 access data here )}
2009-04-14 14:51:22 access data here )}
2009-04-14 14:51:22 access data here )}
2009-04-14 14:51:22 access data here data here
info.
Info.
Info.
data here )}
I am currently trying to use the following:
cat log.txt | /scripting/gawk.exe '{d=d""$o}
/2009-04/ {
print d
d=""
}' | > new.txt
What is happening, is it is merging the lines as expected, but incorrectly merging the first line following the matched string.
I would expect the script to create two lines, one for each match of 2009-04, however what is being returned is:
2009-04-14 14:51:22 access data here )}
2009-04-14 14:51:22 access data here )}
2009-04-14 14:51:22 access data here info. info. info. data here. )} 2009-04-14 14:51:22 get data here )}
2009-04-14 14:51:22 access data here )}
2009-04-14 14:51:22 access data here )}
How do I stop the second matching line from being appended? Shouldn't it be on its own line since it is the next instance of 2009-04?
Thanks in advance..