I need to parse a log file which is in txt format.
I need to match the String and read above and below lines of the matched String.
I need to do something similar to grep -A 30 -B 50 'hello'.
If You have any other suggestions to do it you are welcome.
You may use following code(uses java 5 api java.util.Scanner):
You may want to add additional checks for
prevbeing not null and Callingscanner.hasNextLine()beforeString next = scanner.nextLine()