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

Re: obtener string que hace match con cierta regex



gracias por la ayuda, era eso lo que buscaba

aunque aun asi no me sirve... pero pq realmente tiene q ejecutarse en un solaris 2.6 cuyo sed no acepta lo del [:digit:]... debia haberlo dicho antes, sorry O:)

al final he acabado utilizando esta linea d awk (el nawk d solaris 2.6)

nawk '{ if (match($0,/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/)) { print substr($0,RSTART,RLENGTH) }'

(si alguien sabe como acortar la tira d [0-9] estaria bien, aqui algo del estilo {12} o \{12\} no me ha funcionado)

gracias tb a los demas por sus ideas :)

saludos

On Tue, 20 Mar 2001 15:58:18 +0000 (GMT)
Xavier González Onrubia <is04392@salleURL.edu> wrote:

> On Tue, 20 Mar 2001, Ivan Lopez wrote:
> 
> > gracias por las ideas, pero no sabriais una forma de hacerlo sin
> > utilizar perl? no puedo disponer de el en la maquina en question :(,
> > por eso necesito hacerlo con herramientas como sed, awk... o el propio
> > bash
> >
> > un saludo
> 
> sed s/[^[:digit:]]//g
> 
> Literalmente "sustituye por nada lo que no sea un dígito"
> 
> Más info en man 7 regex
> 
> Ta luegos
> 
> -----------------------------------------------------------------------------
> Xavier Gonzalez Onrubia			E-Mail:   	 is04392@salleURL.edu
> 					WWW: http://www.salleURL.edu/~is04392
> 					Linux User no.66357
> 
> "Programming today is a race between software engineers striving to build
>    bigger and better idiot-proof programs, and the universe trying to produce
>    bigger and better idiots.
> 				So far the universe is winning." - Rich Cook
> 



Reply to: