Displaying only data matching a pattern?

Kevin D. Clark kevin_d_clark at comcast.net
Mon Feb 2 11:52:56 EST 2009


kenta writes:

> Otherwise, I want as an end result:
> 
> A1234567890B
> C9234567890E
> A8234567890B
> F7234567890D

How about?:

 sed 's/^[a-zA-Z0-9][a-zA-Z0-9]*:\([A-Z][0-9][0-9]*[A-Z]\).*/\1/'

I've made the regexp here a little bit tight in order to prevent false
positives.

Regards,

--kevin
-- 
GnuPG ID: B280F24E                Meet me by the knuckles
alumni.unh.edu!kdc                of the skinny-bone tree.
http://kdc-blog.blogspot.com/     -- Tom Waits


More information about the gnhlug-discuss mailing list