[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] Ordenar arquivo
From: |
Thobias Salazar Trevisan |
Subject: |
Re: [shell-script] Ordenar arquivo |
Date: |
Tue, 2 Oct 2001 15:54:53 -0300 (BRT) |
Mauricio, esta ai o script para ordenar....
#!/bin/bash
if [ "$1" = "" ]; then
echo "Usage: $0 <file>"
exit 1
fi
rm -f _sort.tmp
cat "$1" | while read;
do
if [ `echo "$REPLY" | grep -c "define("` = "0" ]; then
if [ -e _sort.tmp ]; then
sort -b -t '"' -k 2 _sort.tmp >> "new_$1"
rm -f _sort.tmp
fi
echo "$REPLY" >> "new_$1"
else
echo "$REPLY" >> _sort.tmp
fi
done
echo "Created file new_$1"
--
Learn to pause -- or nothing worthwhile can catch up to you.
----
Thobias Salazar Trevisan <address@hidden>
Home Page - http://www.cos.ufrj.br/~thobias
Parallel Computing Laboratory / COPPE
Federal University of Rio de Janeiro
Brazil
__________________________
| |
| Against - HTML Mail |
| |
--------------------------
On Mon, 1 Oct 2001, Mauricio Bonani wrote:
> Date: Mon, 01 Oct 2001 12:56:54 -0300
> From: Mauricio Bonani <address@hidden>
> Reply-To: address@hidden
> To: address@hidden
> Subject: Re: [shell-script] Ordenar arquivo
>
> At 10:36 1/10/2001 -0300, you wrote:
>
> > Mauricio,
> >
> > Vai lendo o arq, e coloca um while tendo como parametro o
> > delimitador da secao, (vai lendo com read), ele coloca a linha na
> > variavel REPLY, vai colocando isto em arqs diferentes, ou seja, primeira
> > secao 001.txt ...., apois isto vc vai ter quebrado o arq global, e varios
> > outros. Apos isto use um sort normal para ordenar os n arquivos que vc
> > criou, e junte todos novamente...
> > Ah, se o teu define nao for sempre com esta palavra, vc pode cortar
> > isto fora, e ordenar, depois com o vi, acrescente isto novamente.
> > Ok?! Da proxima vez mande mais detalhes do arq.
> >
> > T+,
> >Thobias.
>
> Abaixo algumas linhas do arquivo global.php:
>
> /*****************************************************/
> /* AutoLink Admin */
> /*****************************************************/
>
> define("_AUTOLINK","AutoLink");
> define("_KEYWORD","Palavras-chave");
>
> /*****************************************************/
> /* Modules Admin */
> /*****************************************************/
>
> define("_MODULESADMIN", "Administração de Módulos");
> define("_MODSINSTALLED", "Módulos instalados atualmente");
> define("_FINDMOD", "Find Modules");
> define("_DISABLE", "Desabilitar");
> define("_ENABLE", "Habilitar");
> define("_HELP", "Ajuda");
> define("_CREDITS", "Créditos");
> define("_LICENSE", "Licença");
> define("_VIEW", "view");
> define("_MODINFO", "Module Infomation");
>
> /* END NEW TRANSLATIONS */
>
> /*****************************************************/
> /* Charset for META Tags */
> /*****************************************************/
>
> define("_CHARSET","ISO-8859-1");
> define("_METAKEYWORDS","Meta Keywords");
>
> /*****************************************************/
> /* Common texts */
> /*****************************************************/
>
> define("_SEND","Enviar");
> define("_URL","Link");
> define("_PRINTER","Imprimir");
> define("_FRIEND","Envie esta notícia a um amigo");
> define("_SEARCH","Busca");
> define("_LOGIN","Login");
> define("_WRITES","escreveu");
> define("_POSTEDON","Postado em");
> define("_NICKNAME","Nome");
> define("_PASSWORD","Senha");
> define("_WELCOMETO","Bem-Vindo");
> define("_EMAIL","Email");
> define("_REALNAME","Nome Verdadeiro");
> define("_FUNCTIONS","Funções");
> define("_EDIT","Editar");
>
>
>
> --
> Mauricio Bonani
> mailto:address@hidden
> ICQ UIN: 2743356
>
> Você quer ser um vencedor ? Creia em Jesus !
>
>
> Sair da lista: address@hidden
> Banco Dados: http://www.egroups.com/group/shell-script
>
> Seu uso do Yahoo! Grupos é sujeito às regras descritas em:
> http://br.yahoo.com/info/utos.html
>
>