|
发表于 2006-11-2 10:06:00
|
显示全部楼层
- #!/bin/bash
- #filename:table.sh
- sourcefile=$1
- targetfile=$2
- distance=$3
- for ((i = 1; i <= distance; i++ ));do
- count=1
- res=""
- for line in `cat $sourcefile`;do
- if ((count % distance == i % distance));then
- res="$res $line"
- fi
- count=$((count + 1))
- done
- echo $res >> $targetfile
- done
复制代码 命令:./table.sh filea fileb 3 |
|