I have these in 1.txt:
Modified Reference MM-EE-145 by:
Reference MM-EE-145
Reference S1-123-BCD :
Reference S43-FF-F3-SMY_3 :
Reference PB-xx-xx
So, I need to grep the matches starting with Reference -whateverhere- and ending with ‘:’
grep '^Reference' 1.txt
But in the matches I also get lines without the ‘:’ and I don’t need those.
Add
.*:$in order to match lines ending with:, like this: