Lindqvist - a blog about Linux and Science. Mostly.
Pages
Home
Computational Chemistry Software
Chemistry
Wine
Kernel
Misc. Linux
OS X/Windows
whoami
Showing posts with label
rotate matrix using gawk
.
Show all posts
Showing posts with label
rotate matrix using gawk
.
Show all posts
26 July 2011
9. rotating a matrix
I lifted this off of some website at some point, but can't remember where and so can't give credit.
rotate.sh
gawk '
{
for (i=1; i<=NF; i++) {
a[NR,i] = $i
}
}
NF>p { p = NF }
END {
for(j=1; j<=p; j++) {
str=a[1,j]
for(i=2; i<=NR; i++){
str=str" "a[i,j];
}
print str
}
}' $1
Older Posts
Home
Subscribe to:
Posts (Atom)