I have a log file with a list of many entries. With grep regex I want to match the first word and another word which can be anywhere in the string.
For example, if I specified "user1" the search would search:
grep -E '^(IP_CONNECT|IP_DISCONNECT) user1' file.txt
However this won't match unless user1 is at the beginning of the string whereas I want to match it if it appears anywhere in the string. How is this done?