From: Adrian Tepes Date: 2010-12-14T22:59:24+09:00 Subject: Re: Grep a string I think use sed is more convenient: grep "sync;sync;reboot" cron* |head -1 | sed 's/[0-9*\\]//g;s/^[ ]*//' If you want to use ruby to shave the expression you can find what you wanted in ruby regexp,it's a piece of cake in ruby world. -- Posted via http://www.ruby-forum.com/.