[Bulma] Dudas de regexp, sed y awk

Sergi Barroso hiroru en lionclan.org
Jue Abr 24 18:00:13 CEST 2008


Moltes gràcies mateu,

Finalment he utilitzat una altre mètode de awk per un altre problema, però 
gràcies igualment

El Miércoles, 23 de Abril de 2008, Mateu Mir escribió:
> Amb AWK ho pots fer de la seguent manera:
>
> #!/bin/bash
> i=1
> for p1 in `awk '{print $1}' fitxer1`
> do
> 	echo -n $p1","`awk -v n=$i -F , '{print $n}' fitxer2 `":">>fitxer3
> 	let i+=1
> done
>
>
> Pensa que nomes t'ho bé si hi ha el mateix nombre de paraules als
> fitxers 1 i 2, o si 2 es més gran tampoc no fallara.
>
> Salut!
>
> 2008/4/23 Sergi Barroso <hiroru en lionclan.org>:
> > Gràcies Toni,
> >
> > Tot i que ha de ser estrictament amb sed o awk, ja que anirà a dins d'un
> > script de bash.
> >
> > Merci
> >
> > # Amb python pots fer algo així de cutre
> >
> >
> >
> > #
> > # fd0 = open("file0")
> > # linies = fd0.read().split('\n')
> > #
> > # fd1 = open("file1")
> > # paraules = fd1.read().split(',')
> > #
> > # l = " "
> > # for i in range(len(paraules)):
> > #       l = l + paraules[i] + ',' + linies[i]
> > #
> > # print l
> > #
> > # Òbviament falten moltes coses, excepcions pels fitxers, veure que la
> > # longitud de paraules i de linies coincideixi, etc ...
> > #
> > # Salut!
> > #
> > # --
> > # "Two of the most famous products of Berkeley are LSD and Unix. I don't
> > # think that this is a coincidence."
> > # http://servomac.blogspot.com
> > # _______________________________________________
> > # Bulmailing mailing list
> > # Bulmailing en bulma.net
> > # http://llistes.bulma.net/mailman/listinfo/bulmailing
> > # Etiqueta: http://breu.bulma.net/?l676
> >
> > #
> >
> >
> > --
> >  Sergi Barroso
> >  Linux user #313577
> >  PGPID: 287913B4
> >  http://www.lionclan.org
> >
> > _______________________________________________
> >
> >
> >
> > Bulmailing mailing list
> > Bulmailing en bulma.net
> > http://llistes.bulma.net/mailman/listinfo/bulmailing
> > Etiqueta: http://breu.bulma.net/?l676
>
> _______________________________________________
> Bulmailing mailing list
> Bulmailing en bulma.net
> http://llistes.bulma.net/mailman/listinfo/bulmailing
> Etiqueta: http://breu.bulma.net/?l676



-- 

 Sergi Barroso
 Linux user #313577
 PGPID: 287913B4
 http://www.lionclan.org

------------ próxima parte ------------
Se ha borrado un mensaje que no está en formato texto plano...
Nombre     : no disponible
Tipo       : application/pgp-signature
Tamaño     : 189 bytes
Descripción: This is a digitally signed message part.
Url        : http://llistes.bulma.net/pipermail/bulmailing/attachments/20080424/7d98034e/attachment.pgp 


Más información sobre la lista de distribución Bulmailing