i have 3 lines of output , if second line exists then only condition within the if loop has to exeute other wise it has exit from loop.
i had tried like this but not getting
i have input like this,
i have to check that second line exists or not ?
which condition i have use??? please help me
INPUT:
Machine ID Machine Name Master Check Error Files MachineComments
-----------------------------------------------------------------------
1 SSZ0797 Y Y ssz0797
2 SSZ0795 N Y SLAVE_1
3 SSZ0796 N Y SLAVE_2
its not working
i am taking the input from one file and trying to check the second line existence
SWADM=$SWDIR/util/swadm
SERVEREXISTS=`$SWADM show_servers | awk '{print $1}'| head -5 | tail -1`
if [ "$SERVEREXISTS" != "" ]; then
echo "line exists"
else
echo "line does not exits"
fi