I want to find several lines within a file.
If I have 3 lines I do not have any problems because I use the following to show the last line and the previous 2:
grep -B 2 "lo que busco"
But my question is: what happens when I want to look for the first line, the middle line and the end line? This is by way of example, since they can be in any location.
Should I concatenate or use an & & amp; with a grep?
I tried for example
cat archivo.txt | grep -i "primera busqueda" | grep -i "segunda busqueda" > busqueda.txt
and like that, but it does not work for me.