[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] somar numero
From: |
Flavio Torres |
Subject: |
Re: [shell-script] somar numero |
Date: |
Wed, 12 Jul 2006 18:34:15 -0300 |
User-agent: |
Thunderbird 1.5.0.4 (Windows/20060516) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Eduardo daSilva Ramos escreveu:
> preciso calcular numeros contidos num arquivo ex:
>
> arquivo valores.txt contem
>
> #cat valores.txt
> 23
> 21
> 90
> 32
> o comando deve me retornar a soma de todos estes numeros, alguem pode
> me dar um help?
Uma solução caseira:
linuxuser@proxy:~$ cat val
23
21
90
32
linuxuser@proxy:~$ J=0
linuxuser@proxy:~$ for i in `cat val`;do let J=$i+$J;done
linuxuser@proxy:~$ echo $J
166
_,_._,___
- --
[]'s
Flavio Torres - Administrador de Sistemas
____________________________________________________________________
PGP/GPG: KeyID 0x7720DBDE
http://www.digitalinfo.com.br/gpg/
- -----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d-@pu s: a-- C--- UL+++>+++ P->- L++ E--- W N o K-- w O M V PS PE Y
PGP+++>+++ t--- 5 X R tv-- b++ DI+ D G+++ e h r y+
- ------END GEEK CODE BLOCK------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
iD8DBQFEtWrXNRQApncg294RAt6RAJ0WmRGBK/g08/yoq1H4bVUoj2fu3wCdHlrb
leP8f21v0rtaiJhkk78MHY8=
=9qnp
-----END PGP SIGNATURE-----
- somar numero, Eduardo daSilva Ramos, 2006/07/12
- Re: [shell-script] somar numero, Eriberto, 2006/07/12
- Re: [shell-script] somar numero, Julio C. Neves, 2006/07/12
- Re: [shell-script] somar numero, Eriberto, 2006/07/12
- Re: [shell-script] somar numero, Felipe Kellermann, 2006/07/13