条件を満たす行を取り除く
Posted feedbacks - Erlang
一行づつ処理します。正規表現を使う必要はあまりないかも。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | -module(file_conv).
-export([file_conv/2]).
conv(In, Out) ->
case io:get_line(In, "") of
eof -> true;
Line ->
case regexp:match(Line, "^#") of
nomatch -> io:put_chars(Out, Line);
_ -> false
end,
conv(In, Out)
end.
file_conv(InFileName, OutFileName) ->
{ok, In} = file:open(InFileName, read),
{ok, Out} = file:open(OutFileName, write),
conv(In, Out).
|



にしお
#3366()
Rating0/0=0.00
サンプル入力
サンプル出力[ reply ]