How can I write a fast shell script to match the following in linux. I have tried various combinations of grep commands, sed commands but no success. The "message" section can be repeated any number of times. The contents of the "message" itself will be generic but fixed to the format shown below. I want the output to be something like:
x: y
x1: y1
x: y
x1: y1
x: y
x1: y1
Input:
Posting to abcd
message {
a {
x : y
x1 : y1
}
}
message {
a {
x : y
x1 : y1
}
}
message {
a {
x : y
x1 : y1
}
}