Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Using loop command in UNIX for converting column to row

$
0
0
Dear folks

I have 300 files which one of them are looking like:

Code:

1.SNP
0
0
1
0

I am looking for desire output:

Code:

1.SNP 0 0 1 0
I used this below command to run all of the 300 file at the same time


Code:

for file in *.SNP; do awk '{printf( "%s ", $1 );} END {printf("\n");}' $file > "$(basename "$file" .SNP).gen"; done
But I do not know why all of the *.gen file do not include any information in the *.gen files. Could anyone give me a guide for this problem?

Viewing all articles
Browse latest Browse all 16232

Trending Articles