fix '^foo' match of very beginning of an input for fgrep

Becasue '^foo' is converted to '\nfoo', fgrep cannot find 'foo'
if it's at very beginning of input. This commit fixis that.