[bcn-pm] manipular un fitxer canviant xifres negatives per un zero

Gonzalo Pérez de Olaguer Córdoba gpoc a iies.es
dll mar 17 07:27:34 PDT 2014


-----En respuesta a-----
Fecha: Mon, 17 Mar 2014 12:41:23 +0000
Desde: "Agud Pique, Enric" <eagud.q a tv3.cat>
Para: Barcelona Perl Mongers <barcelona-pm a pm.org>
Asunto: Re: [bcn-pm] manipular un fitxer canviant xifres negatives per un zero

Hola un altre cop,

> en bash algú sap com es faria, sense utilitzar perl?

estrictament bash (POSIX shell):

while read N ; do [ "$N" -lt 0 ] && N=0 ; echo $N ; done < data.dat > data2.dat

-- 
Gonzalo Pérez de Olaguer Córdoba <gpoc a iies.es> --- www.gpoc.es
PGP key 2861C704 --- F206 5671 6789 425D 111C  1302 214F 1934 2861 C704
-------------- part següent --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: no disponible
URL: <http://mail.pm.org/pipermail/barcelona-pm/attachments/20140317/037c745e/attachment.bin>


Més informació sobre la llista de correu Barcelona-pm