Toshio HORI wrote:
>
> In article <34C4C4C8.7914 _at_ jais.u-net.com>,
> terry tashiro <tashiro _at_ jais.u-net.com> writes:
> terry> #!/bin/csh
> terry> set NAME="aaaa"
> terry> awk 'BEGIN { \
> terry> i=0; \
> terry> } \
> terry> /$NAME/ { \
> terry> print $0; \
> terry> }' \
> terry> input_file1
> terry> のように$NAMEをawkの中で展開してくれたら(もちろんこれでは展開
> terry> されません)いいのですが。
>
> こんなん出ましたけど:)
>
> % cat aaa
> #!/bin/sh
> NAME='aaa'
> awk '/'$NAME'/ { print $0; }' $1
> % chmod u+x aaa
> % cat bbb
> 1:a
> 2:aa
> 3:aaa
> 4:aaaa
> 5:aaa
> 6:aa
> 7:a
> % ./aaa bbb
> 3:aaa
> 4:aaaa
> 5:aaa
すっきりしてていいと思います。ありがとうございます。
tashiro