Linux-Bulgaria.ORG
навигация

 

начало

пощенски списък

архив на групата

семинари ...

документи

как да ...

 

 

Предишно писмо Следващо писмо Предишно по тема Следващо по тема По Дата По тема (thread)

Re: lug-bg: Little help about sed editor


  • Subject: Re: lug-bg: Little help about sed editor
  • From: aa@xxxxxxxxxxxxx (atanas argirov)
  • Date: Mon, 5 Jun 2000 16:09:08 +0200 (CEST)



On Mon, 5 Jun 2000, Nikolay Kabaivanov wrote:

> Zdrawejte 
> Imam problem s towa da nakaram redaktora sed da mi podmeni string ot
> wida   "www.company.com/directory" sus stringa "site.company.com"
> problemi suzdawa naklonenata cherta "/"  probwah i niakolko warianata s
> kawicki no nesto ne stana :-(
> Niakoj ima li ideia kak da se kaze na sed che towa e edin cial string ?
> Po princip mezdu chertite triabwa da e "regexp".
> eto kak probwam az :
> -----------------------
> /bin/sed s/www.company.com/support/support.company.com/ some_file
> >another_file
> -----------------------
> Ima il niakakuw nachin da se izbegne prenasochwaneto kum drug fajl, t.e.
> promenite da stawat naprawo w osnownia fajla. 
> Blagodaria predwaritelno.
> -- 

Zdravei,

Ne sym v chas mnogo tochno sys sed, no
 
ako e samo za '/' izpolzvai:

's/www.company.com\/support/support.company.com/gw output' input 

ne vsichki sed versii shte ti pozvolqt da pravish write v syshtiq file,
pone gnu sed 3.02 se pravi na devica (kraen rezultat - truncate).

Tova gornoto moshe da go napravish i na Perl dosta po gyvkavo kato:

/(\w+).company.com\/(\w+)/$2.company.com/g;

primerno. (kakto i po dosta drugi nachini)

Vyobshte edin bezplaten syvet - ako iskash da polzvash regex functions za
stream operacii, po-dobre zabravi za sed, izpolzvai awk ili perl.

... i RTFM. :-)

Shiv i zdrav.

Cheers,
atanas argirov

==================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers)
Otpiswaneto RABOTI !!! : Majordomo@xxxxxxxxxxxxxxxxxx UNSUBSCRIBE LUG-BG
http://www.linux-bulgaria.org/ Hosted by Internet Group Ltd. - Stara Zagora



 

наши приятели

 

линукс за българи
http://linux-bg.org

FSA-BG
http://fsa-bg.org

OpenFest
http://openfest.org

FreeBSD BG
http://bg-freebsd.org

KDE-BG
http://kde.fsa-bg.org/

Gnome-BG
http://gnome.cult.bg/

проект OpenFMI
http://openfmi.net

NetField Forum
http://netField.ludost.net/forum/

 

 

Linux-Bulgaria.ORG

Mailing list messages are © Copyright their authors.