Krijk
September 10th, 2007, 10:41 PM
I want to parse logfiles which have multiple lines for single entries to single line entries.
I know how to get the required data with awk, but I don't know how to connect them with each other. The seperate entries are usually seperated by an empty line. Does anybody have some suggestions how to do this?
Example 1
something
1 else
2 other
3 first
otherthing
1 apple
2 coconut
3 pear
to output
something else
something other
something first
otherthing apple
otherthing coconut
otherthing pear
Example 2
Item1
2007 Sep 10
Proces 12345
Has done something
Item2
2007 Sep 10
Proces 12378
Has done something else
to output
Item1 ; 2007 Sep 10 ; Proces 12345 ; Has done something
Item2 ; 2007 Sep 10 ; Proces 12378 ; Has done something else
I know how to get the required data with awk, but I don't know how to connect them with each other. The seperate entries are usually seperated by an empty line. Does anybody have some suggestions how to do this?
Example 1
something
1 else
2 other
3 first
otherthing
1 apple
2 coconut
3 pear
to output
something else
something other
something first
otherthing apple
otherthing coconut
otherthing pear
Example 2
Item1
2007 Sep 10
Proces 12345
Has done something
Item2
2007 Sep 10
Proces 12378
Has done something else
to output
Item1 ; 2007 Sep 10 ; Proces 12345 ; Has done something
Item2 ; 2007 Sep 10 ; Proces 12378 ; Has done something else