Here are a few tips to improve the performance of grep
on large files:
- Prefix your command with
LC_ALL=C
, in order to use theC
locale with its smaller ASCII charset, instead of UTF-8 - Use
grep -F
to search for a fixed string (if possible), rather than a regex - Remove the
-i
option, if you don't need it
LC_ALL=C grep -F searchString largeFile