When looking for
grep -aiH '^WARN\|^ERROR\|^FATAL' myLogFile.log | \
...
I wrote
if (!line.startsWith("ERROR") || !line.startsWith("WARN")
|| !line.startsWith("FATAL")) {
...
But how would one take into account the “i” flag, making comparisons case indifferent?
Just convert line into an upperCase String first, with this method:
http://docs.oracle.com/javase/1.3/docs/api/java/lang/String.html#toUpperCase()
So instead of
!line.startsWith(...)write!line.toUpperCase().startsWith(...).