Article View: es.comp.os.linux.programacion
Article #7039Re: Consulta Shell
From: Pascal Bourguignon
Date: Sat, 12 Apr 2003 04:29
Date: Sat, 12 Apr 2003 04:29
36 lines
2260 bytes
2260 bytes
Pere Pujal i Carabantes <"ppujal A R R O B A"@airtel.net> writes:
> Hola Stanley!
>
> El dv, 11 abr 2003 a las 21:50 GMT
> Stanley va escriure en
> es.comp.os.linux.programacion:
>
> > Quiz�s sea muy facil, pero mis conocimientos son muy basicos.
>
> > Como puedo hacer un Shell que lea l�nea a l�nea de un fichero de
> > texto,o sea, como le indico que se pare al llegar al final de l�nea �
> > salto de carro( luego con esa l�nea le�da ejecutar� un recuento y
> > volve� a leer la l�nea siguiente.
> >
>
> while read linea < fichero
Pues no. Si se hace as�, cada vez while hara un "read linea <
fichero" y �el read leera la misma primiera l�nea del fichero!
Se hace as�:
while read linea ; do recuento ; done < fichero
> Si quieres poner comentarios en el fichero te puede interesar esto:
> grep -v "^#" fichero|while read -r "this_line"
o:
grep -v "^#" fichero | while read linea ; do recuento ; done
--
__Pascal_Bourguignon__ http://www.informatimago.com/
----------------------------------------------------------------------
Do not adjust your mind, there is a fault in reality.
Technical Details
Message-ID:
<8765pk9w43.fsf@thalassa.informatimago.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!thalassa.informatimago.COM!not-for-mailReferences:
<994c040b.0304111350.414087f7@posting.google.com> <slrnb9ej5k.114.ppujalARROBA@hola.fou.net>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII X-Google-Thread: f86c8,a25bc7d3540e92c3 X-Google-Attributes: gidf86c8,public X-Google-ArrivalTime: 2003-04-11 21:29:35 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!thalassa.informatimago.COM!not-for-mail From: Pascal Bourguignon <spam@thalassa.informatimago.com> Newsgroups: es.comp.os.linux.programacion Subject: Re: Consulta Shell Date: 12 Apr 2003 06:29:32 +0200 Organization: informatimago.com Lines: 36 Message-ID: <8765pk9w43.fsf@thalassa.informatimago.com> References: <994c040b.0304111350.414087f7@posting.google.com> <slrnb9ej5k.114.ppujalARROBA@hola.fou.net> NNTP-Posting-Host: thalassa.informatimago.com (195.114.85.194) Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: fu-berlin.de 1050121773 12340771 195.114.85.194 (16 [41911]) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50