#!/usr/local/bin/perl # $Id: irex-article.perl,v 3.0 1998/11/19 07:12:07 tsuchiya Exp $ # This file is part of IREX tools. # Please refer "Copyright file" at the root directory. # (C) IREX committee IREX実行委員会. All rights reserved. # コマンドラインオプションを解析 @ARGV = split( /\s+/,$ARGV[0] ) if @ARGV==1; ( @ARGV > 1 )|| &print_usage(); while( $_ = shift @ARGV ){ if( /^(-f|--file)/ ){ push( @FILE,shift @ARGV ); # 検索する辞書ファイルを指定する } elsif( /^\d+$/ ){ $DOCNO{$_}=1; # 検索する記事番号を指定する } else { &print_usage(); # 不明なオプション } } for $file ( @FILE ){ open( FILE,"< $file" )||&print_usage(); while( ){ push( @lines,$_ ); next unless m!!; for( @lines ){ next unless m!(\d+)!; print @lines if $DOCNO{$1}; last; } @lines = (); } close FILE; } sub print_usage { die "Usage: $0 file docno...\n",join(",",@ARGV),"\n"; }