André,
Uma resolução quick & dirty, mais conhecida como gambearra:
[EMAIL PROTECTED] ~ $ cat divide.sh
#/bin/bash
arquivo="teste1.txt";
arquivo_entrada="teste.txt";
for line in $(cat $arquivo_entrada); do
echo $line >> $arquivo;
if [[ $line == "teste" ]]; then
arquivo="teste2.txt";
fi
done
[EMAIL PROTECTED] ~ $ cat teste.txt
1
2
3
4
5
teste
6
7
8
9
teste
[EMAIL PROTECTED] ~ $ cat teste1.txt
1
2
3
4
5
teste
[EMAIL PROTECTED] ~ $ cat teste2.txt
6
7
8
9
teste
Certamente há uma resolução bem melhor pra esse problema. Mas por hora
pensei apenas nisso :-)
[]'s
On 5/15/07, André Unno <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
> Bom dia pessoal.
> Eu tenho um arquivo texto com o seguinte conteúdo:
>
> 1
> 2
> 3
> 4
> 5
> teste
> 6
> 7
> 8
> 9
> teste
>
> Eu preciso dividir esse arquivo em dois onde o primeiro arquivo deve conter:
>
> 1
> 2
> 3
> 4
> 5
> teste
>
> E o segundo arquivo deve conter:
>
> 6
> 7
> 8
> 9
> teste
>
> Alguém poderia me ajudar?
>
> --
> André Unno
> GNU/LinuxCounter#390708
> http://counter.li.org
>
> O sistema pediu: "Requires Windows 9x, Windows 2000 or better".
> Então eu instalei Linux.
>
> [As partes desta mensagem que não continham texto foram removidas]
>
>
--
Eduardo Otubo
Linux Registered User #424252
http://z3r00.blogspot.com/
|_|0|_|
|_|_|0|
|0|0|0|