[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] expressão regular e AWK
From: |
Aurelio Marinho Jargas |
Subject: |
Re: [shell-script] expressão regular e AWK |
Date: |
Tue, 23 Nov 2004 17:19:36 -0300 (ART) |
oi alain,
--- Alain <address@hidden> escreveu:
> server timex.cs.columbia.edu iburst # US para garantir (NY)
> server ntp.ourconcord.net iburst # idem MIT (MA não pinga)
> server ntp.pads.ufrj.br iburst # 146.164.48.1
> #server ntp.ufes.br iburst # 200.137.65.132
> server 200.192.112.8 iburst # ntp1.pucpr.br
> server 127.127.1.0
> fudge 127.127.1.0 stratum 10
> ...
> com este script eu jugo como parametro o nome dos servidores menos o
> local como parametro para outra função:
> $(/^server/ {if (substr($2,1,3) != "127") printf " %s", $2;})
> só que esse "if" ficou horrível. Não dá para fazer tudo dentro da
> expressão regular?
em expressões regulares normais, negar uma string ou é um
xunxo ou é impossível. no teu caso teu comando está bom.
com ERs vai ficar mais feio:
sed -n 's/^serverTAB\([^1][^2][^7][^TAB]*\).*/\1/'
onde TAB é um TAB literal.
falou.
=====
--
Aurelio Marinho Jargas, Curitiba, Conectiva
Funcoes ZZ v4.1111 http://aurelio.net/zz
txt2tags v2.1 http://txt2tags.sf.net/pt
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com