How to speed up the grep command

Hello! n this post I will show you some useful tips to speed up grep’s linux command execution.

I want to show you these tips using a very big file. I have created a huge file using the following command:

head -c 35G </dev/urandom | tr -c -d 'a-zA-Z0-9' > file.txt

The problem with that is that you will have a very big file without newlines, everything in a single line which was not convenient for this, I decided to write a quick and dirty Golang program for that, this is the source code: