My input file is
cat random.txt
hello my name is hello
When I use egrep '^hello|hello$ random.txt
results are
hello my name is hello
How would I modify the command to instead output something like this
hello my name is
or
my name is hello
basically removing the same word if it starts at the beginning or end of the line if both words were to be on the same line?