unix - Data manipulation using a script -


i have data in following format :

key1:value1 key2:value2 key3:value3     b    c    d   key1:value4 key2:value5 key3:value6   a1   b1   c1    key1..  

and on. number of keys three, , in same order. no lines between values a,b,c,d in original data set.

i want output in format

value3, b c d    value6, a1 b1 c1    .   .   .   

any thoughts on script might able use done

regular expressions can depends on type of values in general can write match key3: [pattern match value] , graph , successive lines before next key1 can grabbed manually loop , stop until new key line , repeat each section.

pseudocode:

current_key = "" while !eof:     line = next_line()     if line has regular expression "key3: value":         process value         current_key = value     else          process line regular abcd value , print or whatever 

there isn't error checking helps going.


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -