πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #8789

Re: suma en bash

#8789
From: Pacolinx
Date: Tue, 08 Oct 2002 04:05
29 lines
2042 bytes
Esteban Navarro wrote:

> Estoy intentando crear un script en bash que me sume los numeros de un
> fichero: ej.
> 
> 12,67
> 14,78

Si,

fich=/elfichero.txt
suma=0
for linea in $(cat $fich); do
        suma=$suma+$linea
done

-- 
          |||
         (o o)
          (_)
--oOOo-oOOo--------------------------------------------------------
Paco . pacolinux@BORRAMEinicia.com  http://inicia.es/de/pacolinux/ Valencia 
( EspaοΏ½a ) .
Linux Reg.User: #287.309. Linux machine: #168.816.  http://counter.li.org/
Debian Sid ( 2.4.19). AMD K6-II. 450 RAM 320
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org
iEkEIBECAAkFAjvxD8cCHQIACgkQdJh7olYT17TOvQCeNcsAPeIuML486fkL5Na984iM4jAAniajKMjXNoaJvxjAIu40/IV7loFp=MjXB
-----END PGP PUBLIC KEY BLOCK---------------------------------------
Technical Details
Message-ID: <t42a7-h2n.ln1@pacohost.aldariasnet.es>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!news-out.cwix.com!newsfeed.cwix.com!nsnmpen1-lo.nuria.telefonica-data.net!nsnmpen2-lo.nuria.telefonica-data.net!pacohost.aldariasnet.es!news
References: <mg9tna.81a.ln@127.0.0.1>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f86c8,56cc30fda95ab037
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-10-07 21:15:08 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!news-out.cwix.com!newsfeed.cwix.com!nsnmpen1-lo.nuria.telefonica-data.net!nsnmpen2-lo.nuria.telefonica-data.net!pacohost.aldariasnet.es!news
From: Pacolinx <pacolinux@BORRAMEinicia.es>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: suma en bash
Date: Tue, 08 Oct 2002 06:05:17 +0200
Organization: Telefonica Data Espagna
Lines: 32
Message-ID: <t42a7-h2n.ln1@pacohost.aldariasnet.es>
References: <mg9tna.81a.ln@127.0.0.1>
Reply-To: pacolinux@BORRAMEinicia.es
NNTP-Posting-Host: 217-127-45-237.uc.nombres.ttd.es
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8Bit
X-Trace: nsnmpen2-gest.nuria.telefonica-data.net 1034050507 28585 217.127.45.237 (8 Oct 2002 04:15:07 GMT)
X-Complaints-To: usenet@nsnmpen2-gest.nuria.telefonica-data.net
NNTP-Posting-Date: Tue, 8 Oct 2002 04:15:07 +0000 (UTC)
User-Agent: KNode/0.7.1