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

 

начало

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

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

семинари ...

документи

как да ...

 

 

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

Re: AW: lug-bg: Perl symbols to characters


  • Subject: Re: AW: lug-bg: Perl symbols to characters
  • From: valery@xxxxxxxxxxxxx (Valery Dachev)
  • Date: Thu, 11 May 2000 10:24:14 +0300 (EEST)



On Wed, 10 May 2000, ISM Kolemanov, Ivan wrote:

> nqkoj znae li script (perl, bash, sh ...) chrez kojto da e vazmozno da
> dobavqm text na opredeleno mqsto v ascii file

Scruipt ne znam i bih si napisal sam. Az specialno (ne che imam mnogo
golqm experience w Perl) bih go naprawil po sledniq nachin ...

> scriptname -add 'text csdchsgdshdcs' > -end  filename

pochwash da prepiswash fajla w drug i kato stignesh kraq si slagash twoite
raboti w oniq kawichki.

> scriptname -add 'text csdchsgdshdcs' > -start filename

yshtoto kato gore, samo che rabotite si gi slagah w nachaloto i posle
zapochwash da prepiswash.

> scriptname -add 'text csdchsgdshdcs' > -line56 filename

pochwash da si prepiswash red po red, koeto stawa mnogo lesno na perl:

open(FILE, $ImeNaFajl);
foreach $line (<FILE>) {
        print $line;
}
close(FILE);

towa specialno shte go izpechata, razbira se, na stdout-a ... i kato
stignesh do velaniq red, pishesh si rabotite i prodylvawash natatyk.

tiq tri movesh da gi kombinirash. 

> scriptname -add 'text csdchsgdshdcs' > -afterstring 'shgshfjs' filename

tyj.... ami tuka go wivdam pak s prepiswane, samo che s edin golqm regexp.
wsyshtnost pyrwo shte load-nesh fajla w edna promenliwa i posle shte i
naprawish regexp ot roda na:

$file =~ s/(.*)$string(.*)/$1$string$raboti$2/

ne sym go probwal, no move i da bachka. w sluchaq, $string e string-a,
sled kojto shte add-wash, $raboti sa rabotite deto shte addwash, $1 e tuj
predi 'shgsdfjs' (w primera ti), a $2 tuj deto e sled nego.

> pak ako ima i za izvazdane, savsem ste e na nivo ;o)

ami pak s regexp. naj dobre fani nqkoi perl script-owe i wiv tam kak sa
izpolzwani regexp-owete i gi nauchi. Wednyv kato im hwanesh cakata, stawa
mnogo lesno. Wiv i man-stranicite "perlre", "regex" i wyobshte wiv kakwo
shte ti dade "locate regex | grep man" i gi cheti. Wiv i info-to.

                                                                Valery
.........................................................................
: User ID      : Valery Dachev <v.dachev@xxxxxxxx>                      :
: Homepage     : http://web.dir.bg/valery/                              :
: PGP Key ID   : 1024D/1C4C9712 (DSA)                                   :
: Fingerprint  : C451 0CC8 8EB4 655C D7C8  9D7F DCE9 C14E 1C4C 9712     :
:..............:........................................................:
: Organization : Bulgarian Linux Society : WWW : http://linux.home.bg/  :
:..............:.........................:.....:........................:

==================================================================
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.