I have a very simple sequence of bash commands:
echo "output 3:"
echo "abc shalom" >|F1
echo " abc shalom 4" >> F1
echo "abc shalom12" >> F1
echo "abc shalom123 shalom6" >> F1
echo "abcshalom22 456 shalom" >> F1
egrep "(^|[ ]*)[^ ]+[ ]+shalom($|..[ ])" F1
the output is:
abc shalom
abcshalom22 456 shalom
I can't understand how this simple regex works, I understand that the pipeline is "or", but I dont understand how do I get those two lines...
Could someone please explain me step by step what happened in this short regex?