この単純なサンプル コードを使用して、groovy でファイルを読み取っています。
file.eachLine {line->
// do something with line
}
たとえば、私のファイルには次のようなデータがあります
blah blah blah
This is some more lines
more lines
Insert into something
(x1,x2,x3)
(Select * from
some table
where
something = something)
on rowid = something;
だから私はスニペットを読みたいです。最後に「セミコロン」もあるrowidの行が表示された場合。次に、「(select」まで読み返したい
したがって、このファイルを読んだ後、次を含む文字列が必要です。
(Select * from
some table
where
something = something)
on rowid = something;
それは可能ですか?そしてどうやって?