Please help me write script
Hi I need to have a script which lists all rpm files which are modified.
I need to run rpm -qa | grep NC |xargs rpm -V out put= .......T c /etc/logrotate.d/attivio_adb .......T c /etc/monit.d/monit_common.conf .......T /opt/cisco/bin/showver.sh .......T /etc/logrotate.d/attivio S.5....T c /opt/attivio/conf/log4j.xml S.5....T /opt/mgmt/scripts/pfile .......T c /opt/cic/tomcat/conf/tomcat-users.xml Now I need only files which are modified i.e files look like below S.5....T c /opt/attivio/conf/log4j.xml S.5....T /opt/mgmt/scripts/pfile any body can give a script. Thanks! Praveen |
Quote:
Code:
rpm -qa | grep NC |xargs rpm -V | grep '^S' |
Thanks for help.
But I have soem more help I could able to list those files like this using rpm -qa | grep NC |xargs rpm -V | grep '^S' S.5....T c /opt/attivio/conf/log4j.xml S.5....T /opt/mgmt/scripts/pfile .. Now I need to copy /opt/attivio/conf/log4j.xml /opt/mgmt/scripts/pfile .. so on.. What ever I got listed should copy to another file. basically S.5....T c S.5....T Should be chomped off and cp /opt/attivio/conf/log4j.xml /new_directory/ cp /opt/mgmt/scripts/pfile /new_directory/ ... Please let me know how I can go ahead Thanks in advance. |
Quote:
Code:
rpm -qa | grep NC |xargs rpm -V | grep '^S' | awk '{print $NF}' |
Thanks for help but I used another way to get it done.
#!/bin/bash #set -x rpm -qa | grep ^NC | xargs rpm -V | grep ^S > /tmp/changeset.dat cd /tmp/ cat changeset.dat| while read line do cut -b 12- > changeset1.dat done for file in `cat changeset1.dat` do cp -r $file /tmp/test done #Remove temp directory at last rm -rf changeset.dat changeset1.dat |
Thanks to all
Thanks to all, and I figured out to do using cut command and while loop.
Thanks! |
All times are GMT -5. The time now is 09:22 AM. |