Please explain to me why the following expression doesn't output anything:
echo "" | egrep ""
but the following does:
echo "" | egrep ""
The behaviour of the first is as expected but the second should not output. Is the "
AS @hwnd said < matches the begining of the word. ie a word boundary b must exists before the starting word character(character after < in the input must be a word character),
In your example,
echo "" | egrep ""
In the above example, egrep checks for a literal < character present before the lastname string. But there isn't, so it prints nothing.
$ echo "" | egrep ""
**
But in this example, a word boundary b exists before lastname string so it prints the matched characters.
Some more examples:
$ echo "namelastname@domain.com" | egrep "
$ echo "namelastname@domain.com" | egrep "
$ echo "namelastname@domain.com" | egrep "
namelastname@domain.**com**
$ echo "" | egrep ""
$ echo "n-ame-lastname@domain.com" | egrep "
n-**ame-lastname@domain.com**