Hi,
I have a file with the list of RPMs in the following format
unix-abc-bin-1.27.1-006901
unix-abc-cfg-1.27.1-006901
unix-xyz-bin-1.27.1-006901
unix-abc-bin-1.27.2-006902
unix-xyz-bin-1.27.2-006902
unix-xyz-img-1.27.2-006902
I need the output as shown below
unix-abc-bin-1.27.2-006902
unix-abc-cfg-1.27.1-006901
unix-xyz-bin-1.27.2-006902
unix-xyz-img-1.27.2-006902
Could anyone please help me out in this ? I am a newbee to scripting
Thanks for the response...Now i have a requirement something like this. I have a script as below:
#!/bin/bash -vx
##VARIABLES used below are defined in my profile and am importing them before i use them
rm -f list.log #Extract the RPMs from RPM Database on each of the server
for i in $SERVER; do
echo -n "$i" >> list.log
echo "" >> list.log
ssh $i 'rpm -qa | grep '$CURRENT_VER' ' >> list.log
done
#Extract Info from the Delivery Server
rm -f $DELIVERY_LOG
for j in $WEBDAV_SERVER; do
echo $DELIVER_DIR
ssh <user_name>@$j 'find '$DELIVER_DIR' -type f -name "vst3*.rpm" -printf %f\\n ' >> $DELIVERY_LOG
done
# Compare the files delivery and list two get the difference.
Now here is what i am facing the problem.
I need to sort the $DELIVERY_LOG taking only higher version of the RPM and make it $FINAL_LOG
I need to compare $FINAL_LOG with the list.log and i should get the output as below
the RPM in $FINAL_LOG is missing on the server *$i
Will i have to create a property file which has which all RPMs are present on each server first? or is there any other method