How to extract a piece of information from a huge file

Hello All,

I need some assistance to extract a piece of information from a huge file.
The file is like this one :

database information

ccccccccccccccccc
ccccccccccccccccc
ccccccccccccccccc
ccccccccccccccccc

os information

cccccccccccccccccc
cccccccccccccccccc
cccccccccccccccccc
cccccccccccccccccc
cccccccccccccccccc

application information

cccccccccccccccccc
cccccccccccccccccc
cccccccccccccccccc
cccccccccccccccccc
cccccccccccccccccc

I would like to slipt the information in 3 different files or extract it to 3 different files : database_infomation.txt, os_information.txt, application_information.txt.

Let me know if you have any suggestion using AWK.
Thanks,
Marco

awk '{ if ($2=="information") {outfile=sprintf("%s%s.txt", $1,$2)}
        print $0 > outfile
      }'  infile

output:

input:

Thanks for the previous answer, but what can I do if the headers are different? :smiley:

Ex :

database xxx

aaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaa

os yyy

bbbbbbbbbbbbbbbbbc
bbbbbbbbbbbbbbbbbc
bbbbbbbbbbbbbbbbbc
bbbbbbbbbbbbbbbbbc
bbbbbbbbbbbbbbbbbc

application www

cccccccccccccccccc
cccccccccccccccccc
cccccccccccccccccc
cccccccccccccccccc
cccccccccccccccccc

Thanks!