shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RES: [shell-script] queimando a cuca!!!


From: caio ferreira
Subject: Re: RES: [shell-script] queimando a cuca!!!
Date: Fri, 17 Sep 2004 14:23:25 -0300
User-agent: Mozilla Thunderbird 0.5 (X11/20040306)

thobiast wrote:
$ cat lixo
1 2
3 4
5 6
7 8
9 0

$ ./x
1 2 3 4
1 2 5 6
1 2 7 8
1 2 9 0
3 4 5 6
3 4 7 8
3 4 9 0
5 6 7 8
5 6 9 0
7 8 9 0

$ cat x
#!/bin/bash

fim=$(sed -n '$=' lixo)
for i in $(seq 1 $fim);do
    sed -n "$i,\${h;:a;$!{n;G;s/\(.*\)\n\(.*\)/\2 \1/p;ta;};}" < lixo
done

        Comecei a estudar o seu script e percebi uma coisa :

NAME
       seq - print a sequence of numbers

SYNOPSIS
       seq [OPTION]... LAST
       seq [OPTION]... FIRST LAST

DESCRIPTION
       Print numbers from FIRST to LAST, in steps of INCREMENT.

       If  FIRST or INCREMENT is omitted, it defaults to 1.  That is, an omit-
       ted INCREMENT defaults to 1 even  when  LAST  is  smaller  than  FIRST.

                for i in $(seq $fim);do


reply via email to

[Prev in Thread] Current Thread [Next in Thread]