Yes, we can do this through shell scripting.
First, I would recommend you putting a keyword, say "
VIKAS" in my example between output for each servers as :-
Code:
VIKAS
The Server Name
XXXXXX002
-------------------------
2.1 LAPD
Iface Id Link MTU Side
ecc_3_1 4 Up 512 User
ecc_3_2 5 Up 512 User
VIKAS
The Server Name
XXXXXX003
-------------------------
2.1 LAPD
Iface Id Link MTU Side
ecc_3_1 4 Up 512 User
ecc_3_2 5 down 512 User
... and so on.
Then, use this command to put output of each server in different files
Code:
awk '/vikas/{n++}{print > f n}' f=/vikas/op /vikas/output;
In this example, /vikas/output is the base file(as yours) and files needed will be made by op1,op2,op3,op4 ....
Now, you can grep "down" in each file and join them as
Code:
for i in `ls -lrt /vikas/ | awk '{print $9}' | grep op`;
do
grep down $i
if [ $? -eq 0 ]
then
echo $i >> /vikas/down
else
echo $i >> /vikas/up
fi
done;
Now, you have two files
/vikas/down where link status is Down
and
/vikas/up where ink status is UP.
Now, your task is to join all files whose filenames are in
/vikas/down and
/vikas/up.
Just give it a try yourself and then ask if any problem occurs.
Regards,
VIKAS