i want sort columns with headers based on another file headers
file1
eg: i'm having an empty file with only coumn names like
lastname firstname title expirydate stlcno status etc...
another file with same column names and some other as well but in different order...
file2
eg:firstname expirydate stlcno lastname status ....
file2 is having data i want the file1 shud populate with the data in file2 apprpraitely or just sort the file2 sames as file1...
i am very much new to shell scripting please provide an example with code.....awaiting reply