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

Re: sed



(Please send a new mail to debian-user if you're talking about
something new, rather than replying to a message you're not actually
replying to...)

"behapy" <behapy@myrealbox.com> writes:
> 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?

If I were sed, I'd parse that as ^ (start-of-line) *+ (one or more
asterisks) - (hyphen), which isn't what you want.  You really want
start-of-line, any number of characters which aren't +, +, -; this
translates in sed-ese to

  sed -e 's/^[^+]*+-//g' file.txt

-- 
David Maze         dmaze@debian.org      http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell



Reply to: