[Linuxcantabria] Avanzar lineas en bash script
Amaya Rosa Gil Pippino
argil en indra.es
Mar Nov 29 10:21:57 UTC 2005
Hola, ya he conseguido casi casi lo que quería, tengo el pequeño
problema de que tengo mal la condición de salida, yo veo una línea en
blanco y la trato como \n pero creo que no es así... me explico:
Datos:
amaya en argil-linux:~/scripts$ cat prueba
Cluster Status - clustertest
15:26:24
Cluster Quorum Incarnation #32
Shared State: Shared Raw Device Driver v1.2
Member Status
------------------ ----------
platon1 Active <-- You are here
platon2 Active
Service Status Owner (Last) Last Transition Chk Restarts
-------------- -------- ---------------- --------------- --- --------
Apache started platon1 13:09:34 Oct 07 20 0
Tomcat stoped platon1 13:09:34 Oct 07 20 0
nfs started platon1 13:09:34 Oct 07 20 0
amaya en argil-linux:~/scripts$
como se puede ver, después de la línea del nfs, hay una línea en blanco.
CABECERA="Service Status Owner (Last) Last Transition Chk
Restarts"
EOL='\n'
SERVICIO="";
ESTADO="";
HOST="";
LINEA="";
typeset -i N
N=`grep -n "$CABECERA" prueba|cut -d : -f 1`
N=$N+2
while [ LINEA != EOL ] ;
do
echo $N
LINEA="`head -n $N prueba | tail -n 1`"
N=$N+1
echo $LINEA
echo $EOL
if [ $N -eq 15 ] ;
then
exit 0
fi
done
He tenido que poner el cutre if para q salga del bucle, pq nunca la
linea y EOL son iguales. ¿cómo puedo tratar esa linea en blanco?
gracias :)
--
Amaya Rosa Gil Pippino
C/ Mar Egeo nº 4, 1ª Planta
28830 San Fernando de Henares - Madrid (ESPAÑA)
Tel.: +34-91-626.98.47
argil en indra.es
www.indra.es
-------------------------------------------------------------------------------------------------------------------
Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, contiene información de carácter confidencial exclusivamente dirigida a su destinatario o destinatarios. Queda prohibida su divulgación, copia o distribución a terceros sin la previa autorización escrita de Indra. En el caso de haber recibido este correo electrónico por error, se ruega notificar inmediatamente esta circunstancia mediante reenvío a la dirección electrónica del remitente. POR FAVOR, ANTES DE IMPRIMIR ESTE CORREO ELECTRÓNICO CONSIDERE SU APORTACIÓN A LA CONSERVACIÓN DEL MEDIO AMBIENTE POR LA REDUCCIÓN DE CONSUMO DE PAPEL.
The information in this e-mail and in any attachments is confidential and solely for the attention and use of the named addressee(s). You are hereby notified that any dissemination, distribution or copy of this communication is prohibited without the prior written consent of Indra. If you have received this communication in error, please, notify the sender by reply e-mail. PLEASE CONSIDER YOUR ENVIRONMENTAL RESPONSIBILITY BEFORE PRINTING THIS E-MAIL.
More information about the Linuxcantabria
mailing list