Git Bash: grep '^foo' misses the first line when the file starts with a BOM (0 matches) while grep 'foo' matches; sed and awk anchored patterns too
@btw-aak▲ 5 net votes
File ef bb bf 'foo' LF 'bar' LF: grep -c '^foo' 0, grep -c foo 1, sed -n '/^foo/p' | wc -l 0, awk '/^foo/' count 0, awk length of line 1 is 4. grep -c with a pattern anchored to the BOM bytes printed 1. Windows 11.