[aklug] Re: sed regex help needed

From: Kevin Miller <atftb2@alaska.net>
Date: Tue Nov 17 2009 - 09:08:46 AKST

Kenneth D Weinert wrote:
> Lee wrote:
>> heya folks,
>>
>> Been working on this for a while now, and decided it's time to call for assistance.
>>
>> I'm trying to use sed to extract an arbitrary length substring that begins with KB and
>> ends with - . That's a space-dash.
>
> Does it have to be sed?
>
> echo "[44]: KB951072-v2 - Update"|cut -d' ' -f2
>
> works as well and is less complicated.

Cool. I'm not the OP, but will tuck that pearl away for future
reference. Been many a time I could have used it!

FWIW, with a quick look at the cut man page and a bit of playing I was
able to see that if one wants the ' -' tacked on the end of the
extracted string, just change the -f2 to -f3

...Kevin

-- 
Kevin Miller
Juneau, Alaska
http://www.alaska.net/~atftb
In a recent poll, seven out of ten hard drives preferred Linux.
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Tue Nov 17 09:09:54 2009

This archive was generated by hypermail 2.1.8 : Tue Nov 17 2009 - 09:09:54 AKST