海是我向往的地方,吸纳和咆哮是他的魅力!!!

将文件中的内容分列显示(linux脚本)

上一篇 / 下一篇  2008-11-04 15:33:50

#! /bin/bash
c=1
str=""
while read line; do
    if [ $c != 4 ]; then
        if [ $c = 1 ]; then
            str="$line"
        else
            str="$str        $line"
        fi
    else
        c=1
        echo "$str"
        str="$line"
    fi
    c=`expr $c + 1`
#echo $line
done  < 123
echo "$str"

123中的内容为:
11
22
33
44
55
66
77
88
99
10

TAG:

 

评分:0

我来说两句

Open Toolbar