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

Re: sed



behapy wrote:

> kdjwiskjkdf+-www.kde.org+-333.kjkd.html
> kdjfwiwji+-kbs.co.kr+-cgi-bin+-kkk.cgi
> kdjfwiwji+-kbs.co.kr+-cgi-bin+-kk2.cgi
> 
> =>
> 
> www.kde.org+-333.kjkd.html
> kbs.co.kr+-cgi-bin+-kkk.cgi
> kbs.co.kr+-cgi-bin+-kk2.cgi
> 
> I'd like to remove the first words everyliles ~+-
> 
> sed -e 's/^*+-//g' SOMEFILE.TXT don't work.
> How do I do?

The use of a two-character field delimiter makes this uglier than it
ought to be. It looks like you've substituted +- for occurrences of / in
the original strings; putting the /s back would make this easier. So
that's what I'll do...

sed -e 's/+-/\//g;s/^[^/]*\///' SOMEFILE.TXT

If it's really necessary, you can append ';s/\//+-/g' to the sed pattern
to change the slashes back to +-.

Craig

Attachment: pgpjHvMgd08NN.pgp
Description: PGP signature


Reply to: