how to grep multiple scripts from crontab
by rahul72_s from LinuxQuestions.org on (#51HY2)
I have been struggling to grep only strings out of multiple scripts at crontab -l via awk and print.
Since my crontab include different methods to access scripts as shown below, i cannot generate reports with just awk and grep
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/bin/lpstat -r >/netapp/NIMSOFTUX/lpsched/`hostname`_lpsched.log 2>&1
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /SAPADMIN/UNIX/Scripts/DP_zombies_monitor.sh 2::: > /netapp/NIMSOFTUX/DP-Zombies/`hostname`_DP-Zombies.log
00 4 * * 6 su - orasbt -c "/SAPADMIN/Oracle/Scripts/dbverify.ksh /SAPADMIN/Oracle/Profiles/dbverify.pfl" >/dev/null 2>&1
00 7 * * 6 su - orasbv -c "/SAPADMIN/Oracle/Scripts/dbverify.ksh /SAPADMIN/Oracle/Profiles/dbverify.pfl" >/dev/null 2>&1
00 13 * * 0 find /usr/sap/SBV/DVEBMGS08/log -xdev -name 'audit_*' -mtime +365 -exec rm {} \; >/dev/null 2>&1
resuts from awk -
crontab -l | egrep -v '^#|^$'|awk '{print $6}'
/opt/sapsmd/bin/sapsmd_utility
/usr/bin/lpstat
/SAPADMIN/UNIX/Scripts/DP_zombies_monitor.sh
su
su
su
su
su
su
/SAPADMIN/Oracle/Scripts/cleanup/Oracle_cleanup_saptrace.ksh
find
su
su


Since my crontab include different methods to access scripts as shown below, i cannot generate reports with just awk and grep
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/bin/lpstat -r >/netapp/NIMSOFTUX/lpsched/`hostname`_lpsched.log 2>&1
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /SAPADMIN/UNIX/Scripts/DP_zombies_monitor.sh 2::: > /netapp/NIMSOFTUX/DP-Zombies/`hostname`_DP-Zombies.log
00 4 * * 6 su - orasbt -c "/SAPADMIN/Oracle/Scripts/dbverify.ksh /SAPADMIN/Oracle/Profiles/dbverify.pfl" >/dev/null 2>&1
00 7 * * 6 su - orasbv -c "/SAPADMIN/Oracle/Scripts/dbverify.ksh /SAPADMIN/Oracle/Profiles/dbverify.pfl" >/dev/null 2>&1
00 13 * * 0 find /usr/sap/SBV/DVEBMGS08/log -xdev -name 'audit_*' -mtime +365 -exec rm {} \; >/dev/null 2>&1
resuts from awk -
crontab -l | egrep -v '^#|^$'|awk '{print $6}'
/opt/sapsmd/bin/sapsmd_utility
/usr/bin/lpstat
/SAPADMIN/UNIX/Scripts/DP_zombies_monitor.sh
su
su
su
su
su
su
/SAPADMIN/Oracle/Scripts/cleanup/Oracle_cleanup_saptrace.ksh
find
su
su