781. Re: ActiveState Perl5 の日本語化


番号順一覧Top スレッド順一覧Top
作者: Kenichi.Tamura
日時: 2006/10/24(23:01)
たむらです。ちゃちゃ

Bruce. wrote:
> Bruce.です。

:snip

> んと、
> 
> perl script.pl file1 file2 file3...
> 
> てな感じで使うスクリプトであるということで良いですか?
> であるなら
> 
> #!/usr/bin/perl
> use strict;
> use warnings;
> use encoding 'cp932';
> 
> use open ':encoding(cp932)';
> use open ":std";
> 
> while (<>) {
>     print if /テーマ/;
>     print if /一覧表/;
> }
> 
> こんな感じで。cp932にしているのはWindowsで使う場合shiftjis (sjis)
> よりも無難だからです。

JScript(WSH)で書いてみました。

while(!WScript.StdIn.AtEndOfStream){
  line = WScript.StdIn.ReadLine();
	if (line.match(/テーマ/)) WScript.StdOut.WriteLine(line);
	if (line.match(/一覧表/)) WScript.StdOut.WriteLine(line);
}

cscript //Nologo f.js < data.txt
みたいに使えます。

* MS日本語OK
* Windowsにほぼ入っている(StdInとかは最近かなIE6必須)
* 正規表現あり□

# ReadLineは勝手に chompするとか試行錯誤は必要だったり(笑

-- 
たむらけんいち<URL:http://www.rubyist.net/~tamura/d/>
Gmailしたい方、メールください(残:50)


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.11/493 - Release Date: 2006/10/23
前の発言: 780. Re: jperl5の正規表現 [Bunta] 2006/10/24(19:48)
後の発言: 782. Re: jperl5の正規表現 [藤岡和夫] 2006/10/25(22:00)
親発言: 727. Re: ActiveState Perl5 の日本語化 [Bruce.] 2006/10/20(23:31)
子発言: 784. Re: ActiveState Perl5 の日本語化 [Bruce.] 2006/10/26(00:35)