awk '$1 == "HDFS" { printf( "%s ", $0 ) }; $1=="state" { print $2 }' /path/to/input
The `awk` script is fairly self-explanatory: On lines where the first field is `HDFS`, append a space to the line and print it as-is with no trailing newline. On lines where the first field is `state`, print the second field _with_ the (implied) trailing newline.