next up previous
: awk : UNIX $B$N%F%-%9%H!&%U%!%$%k=hM}(B : $BI8=`F~=PNO$N%j%@%$%l%/%7%g%s!"%Q%$%W(B

$B%U%#%k%?!<(B

$B$^$:0J2<$N=`Hw$r$7$F$+$i!"$=$N8e$NA`:n$r$7$h$&!#(B ( tcsh $B$N@_Dj$,$^$@$N?M$O!"(B tcsh $B$H%?%$%W$7$F!"(B tcsh $B$r5/F0$7$F$+$i
waltz11% cd $B"+(B $B%[!<%`%G%#%l%/%H%j%#$K0\F0$9$k!#(B
waltz11% mkdir filter $B"+(B filter $B$H$$$&L>A0$N%G%#%l%/%H%j%#$r:n$k!#(B
waltz11% cd filter $B"+(B filter $B$K0\F0$9$k!#(B
waltz11% ln -s ~re00018/gutenberg/* . $B"+(B ~re00018/gutenberg $B$K$"$k%U%!%$%k$K(B $B%7%s%\%j%C%/!&(B
    $B%j%s%/$rD%$k!#(B
waltz11% ls $B"+(B $B$I$&$$$&%U%!%$%k$,$"$k$+!"3NG'$9$k!#(B
$B"*(B alice29.txt $B$J$I$N%U%!%$%kL>$,8+$($k$O$:!#(B
waltz11% cat LIST $B"+(B LIST $B$NCf?H$r8+$k!#(B

$B:#2sG[I[$7$?%U%!%$%k(B ($B0J2<$G$O(B Gutenberg $B%F%-%9%H$H8F$V$3$H$K$9$k(B) $B$N=P=j$K$D$$$F$O!"IUO?(B A. $B!V8EE5(B ($BJ8=q(B) $B$NEE;R2=!W$r;2>H$7$F$[$7$$!#(B

UNIX $B%7%9%F%`$G$O!"I8=`F~=PNO$N%j%@%$%l%/%7%g%s!"(B $B%Q%$%W5!G=$r3hMQ$9$k$?$a!"(B

$BI8=`F~NO$+$iF~NO$7!"I8=`=PNO$K=PNO$7!"B>$NF~=PNO$O;H$o$J$$$G:Q$`(B
$B$H$$$&%3%^%s%I$,B?$$!#(B $B$3$N$h$&$J%W%m%0%i%`$r(B$B%U%#%k%?!<(B$B$H8F$V!#(B $B%U%#%k%?!<$O4JC1$J5!G=$7$+;}$?$J$$$b$N$,B?$$$,(B
$BJ#?t$N%U%#%k%?!<$r%Q%$%W$G@\B3$7$FJ#;($J;E;v$,=PMh$k(B
$B$h$&$K$J$C$F$$$k(B3$B!#(B

$B0J2R2p$9$k!#(B

grep
$B%F%-%9%H!&%U%!%$%k$+$i;XDj$7$?J8;zNs$r8!:w$7$F!"$=$l$r4^$`9T$rI=<($9(B $B$k!#(B
$B!!8!:w$KMQ$$$k%Q%?!<%s$N;XDj$K$O!"(B $B@55,I=8=(B (regular expression4) $B$H8F$P$l$k7A<0$,MxMQ$G$-$k(B ( grep $B$NL>A0$NM3Mh$O(B global/regular-expression/print)$B!#(B
sort
$B%F%-%9%H%U%!%$%k$r9TC10L$G!"=g=xIU$1$F(B($BDL>o$O%"%k%U%!%Y%C%H=g$K(B)$BJB(B $B$YJQ$($k!#(B $BNc$($P!"(B
\begin{itembox}[l]
{$B%[!<%`%G%#%l%/%H%j%#$K$
($B$3$3$G$O(B ls -l ~ $B$N=PNO$NBh(B5$B%U%#!<%k%I$O%U%!%$%k$N%5%$%:$G$"$k!"(B $B$H2>Dj$7$F$$$k!#(B)
wc
$B%F%-%9%H!&%U%!%$%kCf$N9T?t!"C18l?t!"J8;z?t$r?t$($k!#(B
\begin{itembox}[l]{wc $B$G9T?t!
uniq
$BO"B3$9$kF1$8FbMF$N9T$r(B1$B$D$K$^$H$a$k!#(B
-c $B$H$9$k$H!"F1$89T$,2?9TB3$$$?$+I=<($9$k!# \begin{itembox}[l]{$B<vJ8$N$h$&$K8+$($k$+$b$7$l$^$;$s$,!D(B}\footnotesize {\tt waltz...
...erline{\tt cat alice-words \vert sort \vert uniq -c \vert sort -n}
\end{itembox}

$B0lBN2?$r$d$C$F$$$k$N$+(B? $B0lCJ0lCJ3NG'$7$J$,$i%A%'%C%/$7$h$&!#(B
$BD9$$(B $B%3%^%s%I$O%7%'%k!&%9%/%j%W%H(B5 $B$K$9$k$HJXMx$G$"$k!#(B
\begin{itembox}[l]{$B%7%'%k%9%/%j%W%H$NMxMQ(B}\footnotesize\begin{tabular}{ll}
{\tt ...
...
{\tt waltz21\% }\underline{\tt ./top20 alice-words}
\end{tabular}\end{itembox}
/usr/ucb/tr
$BJ8;zC10L$NCV49!":o=|$r9T$&!#(B
/usr/ucb/tr [ -cds] [$BJ8;zNs(B1 [$BJ8;zNs(B2]] $B%Q%?!<%s$K$OJ8;z%3!<%I$r(B 8 $B?J?t$G;XDj$G$-$k(B ($B0J2<$NNc$r;2>H(B) 6 $B!#$^$?J8;z$NHO0O$r(B - $B$G;XDj$G$-$k!#(B A-Z $B$G(B ` A' $B$+$i(B ` Z' $B$^$G$NJ8;z(B ($B$D$^$j1QBgJ8;z(B) $B$rI=(B $B$9!#(B

$B0J2<$G(B /usr/ucb/tr $B$HD9$/BG$D$N$,LLE]$H;W$&?M$O!":G=i$K(B set path=(/usr/ucb $path) $B$H$7$F$*$/$H!"(B $B0J2<$OC1$K(B tr $B$H$9$k$3$H$,$G$-$k!#(B
\begin{itembox}[l]{BSD UNIX $B$N(B tr ({\tt /usr/ucb/tr})}\footnotesize\begin{tabula...
...\\
& $B2~9T$KJQ49!#(B\\
& $B

\begin{itembox}[l]{System V $B$N(B tr}\footnotesize\begin{tabbing}
xxxxxxxxxxxxxxxxx...
...$BNJ8;z$r2~9T$KJQ49!(B\\
\> $B
$B>e5-$N(B alice-words $B$H$$$&%U%!%$%k$O \begin{itembox}[l]{{\tt alice-words} $B$O$3$&$7$F:n$C$?(B}\footnotesize {\tt waltz21...
...t \vert /usr/ucb/tr -cs A-Za-z
'\textbackslash012' > alice-words}
\end{itembox}

$B$@$+$i!"C18l$N=P8=IQEYI=$rF@$k$?$a$K!" waltz21% cat alice29.txt | /usr/ucb/tr -cs A-Za-z '\012' | sort | uniq | sort -n ($B$3$s$J$KD9$$%3%^%s%I$OBG$D5$$K$J$l$J$$!)(B $B$$$6$H$J$C$?$i%7%'%k!&%9%/%j%W%H!*(B)

head
$B:G=i$N?t9T$N$_I=<($9$k%3%^%s%I!#(B
$B%*%W%7%g%s$r;XDj$7$J$$$H:G=i$N(B 10 $B9T$rI=<($9$k!#(B -$x$ $B$H$9$k$H:G=i$N(B $x$ $B9T$rI=<($9$k!#(B
waltz21% head -30 /usr/dict/words     $B"+(B /usr/dict/word $B$N@hF,$+$i(B $30$ $B9T$rI=<($9$k!#(B

( /usr/dict/words $B$O1QC18l$rG<$a$?%U%!%$%k$G$"$k!#(B)
tail
$B%F%-%9%H$N:G8e$NJ}$rI=<($9$k%3%^%s%I!#(B
$B%*%W%7%g%s$r2?$b;XDj$7$J$$$H(B 10 $B9T$N$_I=<($9$k!#(B -$x$ $B$H$9$k$H(B $B:G8e$N(B $x$ $B9T$rI=<($9$k!#(B +$x$ $B$H$9$k$H!":G=i$N(B $x$ $B9T$r=|$$$?;D(B $B$j$rI=<($9$k!#(B
waltz21% cat sawyr10.txt | tail -30     $B"+(B sawyr10.txt $B$N:G8e$N(B 30 $B9T$rI=<($9$k!#(B
nkf
$BF|K\8l$NJ8;z%3!<%I(B($B4A;z%3!<%I(B)$B$NJQ49$r$9$k!#(B $BpJs2J3X%;%s%?!<$N%o!<%/%9(B $B%F!<%7%g%s$GMxMQ$G$-$k$h$&$KJQ49$G$-$k(B ($BJ8;z%3!<%I$rF|K\8l(B EUC $B$KJQ49(B $B$7!"(BCR, C-z $B$r:o=|(B)$B!#(B
nkf -ed $B%U%!%$%kL>(B | tr -d "\032" > $B?7$7$$%U%!%$%kL>(B

$B$^$?!"
nkf -sc $B%U%!%$%kL>(B > $B?7$7$$%U%!%$%kL>(B

($B$?$@$7!"%F%-%9%H!&%U%!%$%k$N7A<0$NJQ49$NL\E*$@$1$J$i$P!"(B /usr/meiji/pub/bin/ $B$K$"$k(B qkc $B$H$$(B $B$&%3%^%s%I$,JXMx$+$bCN$l$J$$!#(B qkc -euz $B%U%!%$%kL>(B $B$G%o!<%/%9%F!<%7%g%s7A<0$K!"(B qkc -ms $B%U%!%$%kL>(B $B$G(B Winwos $B7A<0$K$J$k!#(B qkc -H $B$G%X%k%W$,8+$($k!#(Bqkc $B$K$O(B Windows $BHG$b$"$k!#(B)
sed
$BJ8;zNs$NCV49$J$I!";X<($K=>$C$FJT=8$9$k%3%^%s%I(B ($BM-L>$@$1$I!":#2s$OL>(B $BA0$@$1>R2p(B)$B!#(B
(nkf $B$K$D$$$F$O!"(B $BA02s$N%W%j%s%H$K:GDc8B$N$3$H$O@bL@$7$?$N$G!"$3$3$G$ON,$9$k!#(B)


next up previous
: awk : UNIX $B$N%F%-%9%H!&%U%!%$%k=hM}(B : $BI8=`F~=PNO$N%j%@%$%l%/%7%g%s!"%Q%$%W(B
Masashi Katsurada $BJ?@.(B13$BG/(B6$B7n(B7$BF|(B