BOoRFGOnZ 发表于 2008-8-18 14:27:29

文行行列倒置 转载CU

#!/bin/sh
#ScriptName:rotate
[ $# -ne 1 ] && exit 1
if [ ! -s $1 ]
then
      echo "Usage:rotate datafile"
      exit 1
fi
row=`sed -n '$=' $1`
col=`awk 'NR==1{print NF}' $1`
awk -v row=$row -v col=$col '{for(i=1;i<=NF;i++)a=$i} END{ for(i=1;i<=co
l;i++){ for(j=1;j<=row;j++) printf("%s ",a);printf("\n") } }' $1
页: [1]
查看完整版本: 文行行列倒置 转载CU