I have a tab separated file file.txt
whose contents are as follows :
word11 word12 word13 word14
word21 word22 word23 word24
word31 word32 word33 word34
word41 word42 word43 word44
I want to copy each column in a different file. For example: First file will have contain :
word11
word21
word31
word41
Second file will contain:
word12
word22
word32
word42
I wrote the script for the same (There are 12 columns):
for i in {1..12}
do
awk -F "\t" '{print $i}' file.txt > /tmp/output-$i.txt
done
But all output files contain all the data:
word11 word12 word13 word14
word21 word22 word23 word24
word31 word32 word33 word34
word41 word42 word43 word44
Thanks for the help.