Please show what the original file looks like. You show the first file, but your description leads one to think each line contains more than just those first few characters.
Also, show what you want the output to be.
Host T DPH : 1 Some text
AAA
AAAA
BBBB
AAAA
Host T DPP : 1 Some text
AAA
BBB
ZZZZ
Host R ACK : 1 Some text
AAAA
AAA
AAA
Host T DPH : 2 Some text
AAA
AAAA
BBBB
AAAA
Host T DPP : 2 Some text
AAA
BBB
ZZZZ
Host T DPH : 3 Some text
AAA
AAAA
BBBB
AAAA
Host T DPP : 3 Some text
AAA
BBB
ZZZZ
Host R ACK : 2 Some text
AAAA
AAA
AAA
Host R ACK : 3 Some text
AAAA
AAA
AAA
what i mean is that there are lines which have phrases like i have mentioned and this sequencing of lines is repeated in side original file.
I need to filter lines with these phrases {Host *} from original file as it is so that in output file i have my desired sequence as
Host T DPH : 1 Some Text
Host T DPP : 1 Some Text
Host R ACK : 1 Some Text
Host T DPH : 2 Some Text
Host T DPP : 2 Some Text
Host T DPH : 3 Some Text
Host T DPP : 3 Some Text
Host R ACK : 2 Some text
Host R ACK : 3 Some text