🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: suma en bash

#8790
From: Esteban Navarro
Date: Tue, 08 Oct 2002 09:40
43 lines
1650 bytes
-----BEGIN PGP SIGNED MESSAGE-----

Pacolinx expuso:

> 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
> 

Ok. Solo me ha faltado al final un: 

echo $suma | bc -l 

para ver el resultado.


Gracias mil.


- -- 
Esteban Navarro
http://www.personal.able.es/ensoriano
User Linux 132409 Woody
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv

iQBVAwUBPaKoA1TYMSOusve9AQHUXQH9FEnDcqY2hLWI0NROHqYd6huICE74zKy3
Vwgit4yW14qktYuM2R6QadOiz7fM++JzjadAtZHmUm6fAXP5kNpU9Q==
=e098
-----END PGP SIGNATURE-----
Technical Details
Message-ID: <b69una.if.ln@127.0.0.1>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!62.101.160.109!not-for-mail
References: <mg9tna.81a.ln@127.0.0.1> <t42a7-h2n.ln1@pacohost.aldariasnet.es>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f86c8,56cc30fda95ab037
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-10-08 03:04:34 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!62.101.160.109!not-for-mail
From: Esteban Navarro <scandisk@able.es>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: suma en bash
Date: Tue, 08 Oct 2002 11:40:27 +0200
Organization: Yo Mismo
Lines: 44
Message-ID: <b69una.if.ln@127.0.0.1>
References: <mg9tna.81a.ln@127.0.0.1> <t42a7-h2n.ln1@pacohost.aldariasnet.es>
NNTP-Posting-Host: 62.101.160.109
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
X-Trace: fu-berlin.de 1034071473 18265513 62.101.160.109 (16 [158006])
X-Orig-Path: 127.0.0.1!nobody
User-Agent: KNode/0.6.1