I have two parts of a string that I know, called
phrase2 that are in the same line of a file that occur multiple times throughout the file. I need to extract these lines from the file; however, there are numbers in between that I do not know and the lines can vary. For instance, there are lines that may look like:
phrase1 654654 phrase2 phrase1 22 phrase2 phrase1 949 phrase2 etc.
However, I do know that I can write a code specifically for a particular line. For instance, I can write for line 2 above the following to find it:
grep "phrase1 [0-9][0-9] phrase2" file
What code can I write using grep (or similar) in order to extract all the lines containing both
phrase2 without knowing the numbers, or anything else for that matter, in between?