file 1 col0 col1 col2 col3 col4 col5 ... ... samp1 samp2 samp3 samp4 .... files follow similar format and what i need to do is extract 1st and 4th column from the first file and output on a new file and then take out only 4th column from the rest of the files. So before i work on my actual project, i wanted to try with more simple table. The table i'm working on right now is S1.txt col1 col2 col3 1 4 7 2 5 8 3 6 9 S2.txt col1 col2 col3 1 44 77 2 55 88 3 66 99 The result i'm getting col1 col3 col3 1 4 2 5 3 6 The result i want col1 col3 col3 1 4 77 2 5 88 3 6 99