Lindqvist - a blog about Linux and Science. Mostly.
Pages
(Move to ...)
Home
Computational Chemistry Software
Chemistry
Wine
Kernel
Misc. Linux
OS X/Windows
whoami
▼
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
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment