mutiple lines in single line and remove duplicates from some lines

Here is what I have and this is the entire sequence :

aa="aa1"
etime="1436262792"
from="joe"
test="blah"
test="blah1"
test="blah2"
addr="aa2";
aa="aa1"
etime="1436262792"
from="bob"
test="blah3"
addr="aa2";
etc...

sometime the test line is limited to one, however each separated with “;”.
When there is multiple “test”, I need to keep only the last one.

I am trying to get this results:

aa="aa1" etime="1436262792" from="joe" test="blah2" addr="aa2";
aa="aa1" etime="1436262793" from="bob" test="blah3" addr="aa2";

Thank you for any suggestions,

Al.


Source: shell

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.