in reply to Extracting selected column names and values from tab delimited text file
Two of Corion's code contributions may be of interest:
join - join two files according to a common key part - split up files according to column value
HTH,