Complex use with awk

Hi ,
I have file named docs.txt
The content of the file look like this:

DOC disk location Size
======= ===== ============= =========
TXT A /dev/dm-1 10
TXT B /dev/dm-2 10
BIN C /dev/dm-3 10
TXT D /dev/dm-4 10

Total : 40

From this output , I need to pass to function the following input:
TXT /dev/dm-1 /dev/dm-2 /dev/dm-4
BIN /dev/dm-3

Please note that always, the first two lines are titles .
The last line is statistical record.
Those lines should always be ignored.

Thanks

Try:

for each in `awk '{ print $1 }' filename | sort -u`; do echo "$each  `awk '/'$each'/ {  print $3 }' filename | xargs`"; done

Hi dennis,
Thank you for yor replay.
But how can i make the first two line , and the last record (they are gust a titled as i wrote) "disappear" .
Thanks again for your quick response.

Try:

for each in `awk 'NR>2 && !/Total/{ print $1 }' filename  | sort -u`; do echo "$each  `awk '/'$each'/ {  print $3 }' filename | xargs`"; done