columns into different files

hello all,

my input file(excel workbook) has the following structure

mir-111		mir-222		mir-333		mir-444
abc,45		h,5		jhu,k		jhg,111111
def,56		u,90		kil,10		k,0987
g,5		ki,09		huy,09		o,00000
j,7		molkijhn,88	erf,111		u,9876
k,8		kou,098		eef,122		jjj,kkkkkk

now, i would like to break each mir columns into separate files and process the separate files with comma as delimiter and print $1 in upper case letters

so , now my output files will be as follows

mir-111_op.txt
ABC
DEF
G
J
K
mir-222_op.txt
H
U
KI
MOLKIJHN
KOU
mir-333_op.txt
JHU
KIL
HUY
ERF
EEF
mir-444_op.txt
JHG
K
O
U
JJJ

All helps appreciated. thanks in advance.

What have you tried so far and where are you stuck?

Hi Scrutinizer,

I tried the following

awk '{print $1} input.txt > mir-111_op.txt
awk -F"," '{print toupper($1)}'  mir-111_op.txt > test && mv test mir-111_op.txt

I am able to run individual column by column, but not being able to run a single code for the whole excel file.

Thanks in advance

OK, if you use , as a field separator, it is going to be difficult to split it again later.. Try this:

awk 'NR==1{split($0,F); next}{for(i=1;i<=NF;i++){f=F "_op.txt"; split($i,C,/,/); print toupper(C[1])>f}}' infile