Newsgroups: fj.unix
Path: galaxy.trc.rwcp.or.jp!news.trc!etlnews.etl.go.jp!wnoc-tyo-news!newsfeed.btnis.ad.jp!news-out.internetmci.com!newsfeed.internetmci.com!141.211.144.13!newsxfer3.itd.umich.edu!newsxfer.itd.umich.edu!news.join.ad.jp!Q.T.Honey!aero.kyushu-u!kuee-news!odins-suita!nuis!news.cc.nagoya-u.ac.jp!nfeed.gw.nagoya-u.ac.jp!vega2!arisawa
From: arisawa@vega2.aichi-u.ac.jp (Kenji Arisawa)
Subject: Re: [Q] usgae "tr" or "sed"
Sender: news@vega2.aichi-u.ac.jp (News Master)
Message-ID: <EMzCwo.L4C@vega2.aichi-u.ac.jp>
Date: Sun, 18 Jan 1998 12:48:24 GMT
References: <69sa98$17n@csdnews.sm.sony.co.jp>
Nntp-Posting-Host: vega2
Organization: Aichi University Computer Center, Aichi University, Aichi, Japan.
X-Newsreader: mnews [version 1.18PL3+] 1994-08/01(Mon)
Lines: 41
Xref: galaxy.trc.rwcp.or.jp fj.unix:3828
X-originally-archived-at: http://galaxy.rwcp.or.jp/text/cgi-bin/newsarticle2?ng=fj.unix&nb=3828&hd=a
X-reformat-date: Mon, 18 Oct 2004 15:18:22 +0900
X-reformat-comment: Tabs were expanded into 4 column tabstops by the Galaxy's archiver. See http://katsu.watanabe.name/ancientfj/galaxy-format.html for more info.

$BM-_7(B@$B0&CNBg3X$G$9(B

$B:dK\CRI'$5$s(B:
>lex $B$OIT47$l$J$b$s$G>iD9$K$J$C$F$7$^$$$^$7$?!#<!$G==J,!#(B
>
>%%
>alice   printf("bob");
>bob     printf("alice");

$B$J$k$[$I(B lex $B$,$"$j$^$7$?$+!#(B
lex version 2.5.4
$B$O(B alice & bob $B$NLdBj0J30$K0J2<$N$b$C$H87$7$$%F%9%H$K9g3J$7$F$$$^$9!#(B
($BKM$N(B NEXTSTEP3.3$BHG$G$O%@%a!#$3$l$bF~$lBX$($^$7$g$&!#(B)

%%
john   printf("jo");
jo     printf("john");



$B$D$$$G$K(B tclsh $B$b(B jo&john $B$NLdBj$K%Q%9$7!"(B
set sub(jo) john
set sub(john) jo
set sub(&) {$sub(&)}; # tricky element to avoid egg and chicken problem
while {![eof stdin]} {
gets stdin s
regsub -all {john|jo} $s $sub(&) t
# Not {jo|john} !
eval puts $t
}
exit

$B$H$J$j$^$9!#(B
($BKM$O(B tclsh $B$O9%$-$G$9!#J8K!$,C1=c$GH~$7$$$+$i!#$G$bCY$/$F$M(B...)

$BB>$K2rK!$,$"$j$^$7$?$i65$($F2<$5$$!#(B

perl $B$O:#$N$H$3$m81$7$$$_$?$$!#(B

$BM-_77r<#(B
E-mail: arisawa@aichi-u.ac.jp
