Если я понимаю, попробуйте это
public void method() {
String file = "C:\\text.txt";
LineNumberReader reader = null;
Pattern pattern;
Matcher matcher;
String line=null;
int i;
try {
reader = new LineNumberReader(new FileReader(file));
while ((line = reader.readLine()) != null) {
i = reader.getLineNumber();
String template = "event" + i + ".+end" + i;
pattern = Pattern.compile(template);
matcher = pattern.matcher(line);
if (matcher.find()) {
System.out.println(line.substring((matcher.start()), matcher.end()));
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
В файле
event1 arg arg arg end1
event2 arg arg arg end2
И вывод тоже самое