[CentOS] OT: piped greps with regex

Mon Jan 4 21:59:41 UTC 2010
Stephen Harris <lists at spuddy.org>

On Mon, Jan 04, 2010 at 12:53:45PM -0800, Mr. X wrote:

> Last effort led to this
> $ sudo file mini_vusb.img | grep -Po 'startsector\s+\d+'| grep -Po '\d+'
> 32
> 
> I like this best. Is there a way to shorten it up?

Use the correct tool; "sed"

  sed 's/^.* startsector \(.*\),.*$/\1/'

-- 

rgds
Stephen