From: "Rajesh M." Date: 2010-12-14T22:32:55+09:00 Subject: Grep a string Hi list, I need to grep the entire string "sync; sync; reboot" after 0 10 * * 0 in crontab -l and store it in a variable, that string is different on different systems. crontab -l |egrep -i "(sync|reb|shut)" 0 10 * * 0 sync; sync; reboot <---- regex should look for only sync; sync; reboot cd /var/log grep "sync; sync; reboot" cron* |head -1 cron:Dec 12 10:00:00 hostname CROND[14898]: (root) CMD (sync; sync; reboot) Regular expression should find any string without the digitals (0 10 * * 0) For example in another system if the crontab entry is like: 0 6 * * 0 shutdown -y -g0 -i6 regular expression should only look for the string after digitals 0 6 * * 0, here it should look for shutdown -y -g0 -i6 Please help. Thanks in advance -- Posted via http://www.ruby-forum.com/.