Article View: es.comp.os.linux.programacion
Article #7219Re: script en bash
From: Esteban Navarro
Date: Thu, 20 Mar 2003 00:01
Date: Thu, 20 Mar 2003 00:01
42 lines
1791 bytes
1791 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Pere Pujal i Carabantes dijo:
>> Tengo un fichero de texto con datos numerados, por ejemplo:
>
>> 0001 datos
>> 0002 datos
>> 0003 datos
>> 0007 datos
>> Lo que quiero es un script que detecte los numeros que faltan.
Gracias a todos. Al final lo he solucionado con un script que han posteado
en mi lista: http://www.personal.able.es/ensoriano/lista_linux.html
#! /bin/sh
k=1
cat fichero | while read a;
do
linea=`echo $a | awk -F " " '{print $1}'`
if (test $linea -gt $k); then
while [ $k -ne $linea ]; do
echo $k >> bb
k=`expr $k \+ 1`
done
fi
k=`expr $k \+ 1`
done
- --
Esteban Navarro
Fondos de Escritorio:
http://www.personal.able.es/ensoriano
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+eQTkoVO1uCntWAwRAgsPAJ9dL8L2zMtuM+jI22rBH6lTEIRMZwCfdlu3
nU5/Dzwbc7RDkRk5iOQwbBs=
=vwdR
-----END PGP SIGNATURE-----
Technical Details
Message-ID:
<b5b0be$27oat6$1@ID-158006.news.dfncis.de>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!62.101.160.33!not-for-mailReferences:
<b5abt5$26m7d5$1@ID-158006.news.dfncis.de> <slrnb7hpb8.15v.ppujalARROBA@hola.fou.net>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII-7-bit X-Google-Thread: f86c8,16ef105c94f25822 X-Google-Attributes: gidf86c8,public X-Google-ArrivalTime: 2003-03-19 16:00:48 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!62.101.160.33!not-for-mail From: Esteban Navarro <scandisk@able.es> Newsgroups: es.comp.os.linux.programacion Subject: Re: script en bash Date: Thu, 20 Mar 2003 01:01:38 +0100 Lines: 42 Message-ID: <b5b0be$27oat6$1@ID-158006.news.dfncis.de> References: <b5abt5$26m7d5$1@ID-158006.news.dfncis.de> <slrnb7hpb8.15v.ppujalARROBA@hola.fou.net> NNTP-Posting-Host: 62.101.160.33 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: fu-berlin.de 1048118446 75246502 62.101.160.33 (16 [158006]) User-Agent: KNode/0.7.2