Re: Jugando con awk (parseo)

Phil Hughes <[email protected]>
Newsgroups gmane.org.user-groups.linux.gulcr
Message-ID <[email protected]>
Ok, I didn't think this was coop but how about
awk '{gsub(", ","\n");print}' palabras

On Wed, Nov 15, 2006 at 01:13:33PM -0800, ricardo gamboa wrote:
> 
> Hey, esto es lo que llevo por si alguien le sirve:
> 
> ~ric:~)awk -F "," '{print $1,$2,$3,$4,$5,$6,$7,$8}'
> palabras|gawk -F">"'{ print $2 }'
> 
>  bairn
>  buster
>  changeling
>  child prodigy  infant prodigy  wonder child
>  foster-child  foster child  fosterling
>  imp  scamp  monkey  rascal  rapscallion  scalawag    
> 
>  kiddy
>  orphan
>  peanut
>  pickaninny  piccaninny  picaninny
>  poster child
>  preschooler  kindergartner  kindergartener
>  silly
> ~ric:~)
> 
> PERO,EN ESTE CASO EL ARCHIVO TIENE 8 COLUMNAS ,PERO EN
> OTRO ARCHIVO CON EL MISMO FORMATO, PUEDE TENER 2 O 20
> COLUMNAS(PARECE QUE ES CON "NF" [1]), Y AUN ME SIGUE
> DESPLEGANDO LAS PALABRAS EN UNA SOLA LINEA,CREO QUE LE
> FALTA POCO
> 
> [1]: awk '{print NF}' palabras|sort|tail -1
> 
> o creo que tendria que tener algo como para validar
> todas las columnas para empezar:
>  awk '   {for (i = 1; i<=NF ; i++) num[$i]++ } ....etc
> 
> 
> saludos,
>   -ricardo
> 
> --- ricardo gamboa <[email protected]> wrote:
> > 
> > Hola gente!,
> > 
> > Queria ver si alguien me podilla dar un empujon,con
> > awk :)  (es para un trabajo de la Universidad)
> > 
> > Este el archivo plano
> > 
> > ~ric:~)cat palabras
> >      => changeling
> >      => child prodigy, infant prodigy, wonder child
> >      => foster-child, foster child, fosterling
> >      => imp, scamp, monkey, rascal, rapscallion
> >      => kiddy
> >      => orphan
> >      => peanut
> >      => pickaninny, piccaninny, picaninny
> >      => poster child
> >      => preschooler, kindergartner, kindergartener
> >      => silly
> > 
> > Ocupo que:
> > Despliegue cada palabra en una sola linea
> > 
> > Osea algo como:
> > ~ric:~) awk 'expresion poderosa' palabras
> >       changeling
> >       child prodigy
> >       infant prodigy
> >       wonder child
> >       foster-child
> >       foster child
> >       fosterling
> >       etc...
> > 
> > Lo que no quiero es hacer un script,que habra el
> > archivo y valla linea por linea preguntando y viendo
> > si es ", " y aumente en 1,sino ojala todo en una
> > sola
> > linea.
> > 
> > 
> > Cualquier pista,muchas gracias! :)
> > 
> > Saludos,
> >   -ric
> > 
> > 
> >  
> >
> ____________________________________________________________________________________
> > The all-new Yahoo! Mail beta
> > Fire up a more powerful email and get things done
> > faster. 
> > http://new.mail.yahoo.com
> > 
> > 
> > -- 
> > Desuscripción: escriba a
> > [email protected], tema 'unsubscribe'
> > Problemas a: [email protected]. 
> > http://gulcr.org/ListasDeCorreo
> > 
> > 
> 
> 
> 
>  
> ____________________________________________________________________________________
> Do you Yahoo!?
> Everyone is raving about the all-new Yahoo! Mail beta.
> http://new.mail.yahoo.com
> 
> -- 
> Desuscripción: escriba a [email protected], tema 'unsubscribe'
> Problemas a: [email protected].  http://gulcr.org/ListasDeCorreo
> 

-- 
Phil Hughes, [email protected]  Phone: 505-713-3919  Cell: 505-841-2675
Aptdo. Postal 0012, Esteli, Esteli, NICARAGUA 

-- 
Desuscripción: escriba a [email protected], tema 'unsubscribe'
Problemas a: [email protected].  http://gulcr.org/ListasDeCorreo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.