I need to edit a huge file and only need to keep with the lines that start with [INFO]
.
I already tried
grep "'[^INFO]*'"
and
grep-i '\[^INFO]*'
among other and none of them worked.
Could you help me with this?
I need to edit a huge file and only need to keep with the lines that start with [INFO]
.
I already tried
grep "'[^INFO]*'"
and
grep-i '\[^INFO]*'
among other and none of them worked.
Could you help me with this?
The regex "'[^INFO]*'"
matches all lines with single quotes and no I
, N
, F
or O
characters see https://regex101.com/r/dDX5PQ/1 .
This is the case, because [
and ]
are special characters and denote a rango of characters. When started with ^
it denotes a range of characters not to match.
The regex you want is grep "^\[INFO\].*"
, which will match on all lines that start with [INFO]
see https://regex101.com/r/bIEoBx/2 .