条件を満たす行を取り除く
Posted feedbacks - Groovy
1.1-beta-2で動作確認しました。 > groovy script filename という感じで動作します。 引数チェックやクローズ処理はしてません。手抜きです。
1 2 3 4 5 | new File( args[0] ).eachLine( ) {
if ( it[0] != '#' ) {
println it
}
}
|
1 2 3 4 5 6 7 8 9 10 | def inputfile = new File("c:/in.txt")
def outputfile = new File("c:/out.txt")
def buffer = []
inputfile.eachLine{
if( !(it ==~ /^\s*#.*/) )
buffer << it
}
outputfile.write( buffer.join("\n") )
|


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