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

Re: Замена "вариативного" фрагмента строки.



Andrey Rahmatullin ☫ → To debian-russian@lists.debian.org @ Mon, May 31, 2010 21:18 +0600

> On Mon, May 31, 2010 at 09:13:39PM +0600, Sergey Korobitsin wrote:
> > > Как можно заменить все фрагменты, которые начинаются, например, на
> > > "background-color:" и заканчиваются на ";" ,  на "xxx" ?
> > cat file | sed -e '{ s/background-color:.*;/xxx/g }'
> Думаю, таки .*? (если в седе это делается как везде).

Из grep(1):

Repetition
	A regular expression may be followed by one of several
	repetition operators:	
	?	The preceding item is optional and matched at most once.
	*	The preceding item will be matched zero or more times.

Это, получается, какой-то ограничитель "жадности" звёздочки?

-- 
Bright regards, Sergey Korobitsin | http://the-brights.net/ --
  Arta Software, http://arta.kz/  | illuminating and elevating
  xmpp:undertaker@jabber.arta.kz  | the naturalistic worldview

--
Шрифты в грызлись в нежные глазные яблоки и со смаком захрустели зрачками.
	-- wfrr @ linux.org.ru


Reply to: