Match the empty string at the beginning of word.
Match the empty string at the end of word.
This is also relevant [emphasis mine]:
Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word constituent characters are letters, digits, and the underscore. […]
-w option can match a substring that does not begin and end with word constituents, it differs from surrounding a regular expression with
\>. For example, although
grep -w @ matches a line containing only
grep '\<@\>' cannot match any line because
@ is not a word constituent. […]
And for completeness:
^ and the dollar sign
$ are meta-characters that respectively match the empty string at the beginning and end of a line. They are termed anchors, since they force the match to be “anchored” to beginning or end of a line, respectively.
The pattern you used (
^\<) matches the beginning of a line just before a word constituent character. Neither
< character nor whitespace is a word constituent.
Note a whitespace at the beginning of a line will not trigger a match, regardless if there's a tag or something else right after. Some characters valid for text lines will not trigger a match either (e.g.