指定した文字列以降を出力するrubyプログラム
指定した文字列以降を出力するrubyプログラムを作成した。
a,b,c,d, ----------------------------- A,B,C,D,
このようなファイルがあったとして、
”-----------------------------”を含めてそれ以降を出力する。
読み込む対象のファイル名は引数で与える。
file=open(ARGV[0]) lines=file.read().split("\n") export=false lines.each do |line| if line =~/-----------------------------/ export=true end if export then puts(line) end end file.close