Mailing List Archive


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

Re: [tlug] pattern matching



On Thu, 12 Feb 2004, Brett Robson wrote:

> I know this is a simple question, but I've often needed to do it and
> never come up with a simple way.
>
> I want to grep for a pattern but I don't want to see the whole line,
> just the bit that matches. Sometimes I pipe to cut but in this case I
> don't know where the pattern will be. Surely this is straight forward?

Not with grep, but sed can do it:

sed -ne 's/.*\(tl.*ug\).*/\1/p' file

-- 
Tod McQuillin


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links