Re: OT: piped greps with regex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux