Sorry about the title, but this should be fairly self-explanatory.
My script seems to work, except that in the output, below, the first three lines are correct, but why does it print the additional lines 4, 5, & 6?
Script:
#!/bin/bash
while read;
do
client="$(grep -m 1 Client | awk -F" " '{ print $2; }')"
elapsed="$(grep -m 1 "Elapsed time" | awk -F" " '{ print $3,$4,$5,$6,$7,$8; }')"
volname="$(grep -m 1 "Volume name" | awk -F" " '{ print $3; }')"
echo The client name is $client
echo The elapsed time was $elapsed
echo The Volume name is $volname
done < /home/mine/bakupresult
exit 0
Result
The client name is "BaculaServer-fd"
The elapsed time was 1 min 57 secs
The Volume name is 000003L3
The client name is
The elapsed time was
The Volume name is
How can I stop those last 3 lines from being output?
Any help appreciated.