The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

 $0 -e regex   

   指定した列に指定した正規表現が合致する場合に、その行全体を出力する。
   主要な動作の後に、標準エラー出力に処理した行数などを出力。
 
  $0 -c 列番号  -e 正規表現       # 最も想定されている使い方。
  $0 -c 列番号 -f ファイル名   # ファイルの各行に検索したい正規表現があると見なされる。
  $0 正規表現                 #  列を指定しないで、行全体からマッチすれば、その行を出力
  $0 -~ -c 列番号 -e 正規表現     # -v の指定により、マッチしない行を出力する。
  
 オプション : 
  -c num : 検索対象を探す列を指定する。最左列は1、最右列は-1であり、右に向かうほど1ずつ増加。, や..も使える。
  -e str ; 正規表現の指定。grep と違って -e は1個しか指定できない。(正規表現なので"|"でつなぐとよい。)
  -f filename : 検索する文字列(正規表現では無い)が含まれているファイルの指定。各行がOR条件で検索されることになる。

  -i str : 入力区切り文字の指定。未指定なら、タブ文字。
  -u 0 ; デフォルトで文字列の比較は utf8で行うはずが、それをしない(ASCII文字であるかのように扱う。)

  -~ : 行の選択が反転する(マッチしない行が選択される)。
  -y : マッチするかどうかで 1/0のみ各行に出力する。
  -2 0 : 何行マッチした、などの付加情報を標準エラー出力に出力しない。

  -= ; 先頭行をヘッダと見なし、これに応じた処理をする。
  -: ; データの番号を出力する。

開発メモ: * -f による指定は、各列の各値が完全一致のみであるという不便がある。 * -e による指定は、'^...$' のようにすると完全一致で検索するという説明をする必要のある不便さがある。

NAME

  $0 - pattern searcher given which column to seek together with regular expression

SYNOPSIS $0 -c $tgt_col_num -e $regex # The most usual usage $0 -c $tgt_col_num -f $filename $0 -e $regex $0 -v -c .. .. # unmatch ; reverse the matching condition.

OPTIONS You can specify the options which appears as follows .

  -c number 
      Specify the column number. Note that the leftest column is numbered as 1.

  -f filename       
      The file specified by filename is regarded to contain elements separated 
      by line breaks each of which are to specify the pattern to be matched.