GREEN LIST :
12321 34534
GREEN LIST :
45645 --- 23423
WHITE LIST :
23479 34534 75483 76924
12345 --- 12351 56778 --- 23330
GREEN LIST :
23567
the output must be:
GREEN LIST : 12321
GREEN LIST : 34534
GREEN LIST : 45645 --- 23423
WHITE LIST : 23479
WHITE LIST : 34534
WHITE LIST : 75483
WHITE LIST : 76924
WHITE LIST : 12345 --- 12351
WHITE LIST : 56778 --- 23330
GREEN LIST : 23567
can you see what i mean? partially, i tried doing:
awk '
BEGIN { FS = " " }
/LIST/ { tag = $1 ; next }
/[0-9]/ { print tag, $1 }' < filename
Your solution might be to first remove the new line after "LIST :". I think you know better how to do it than me. At least a newline is \n you should subsitute it with nothing.
Good luck.