Hi! > I always thought, that grep is line based in a way that the current > string doesn't hold the line terminator. > If so, why does, e.g.: > $ printf 'foo' | grep $'\n' > foo > match?
I was surprised at the first moment, too, but I think the answer is in first paragraph of the man page: PATTERNS is one or more patterns separated by newline characters, and grep prints each line that matches a pattern. Thus, grep $'a\nb' find all lines that either contain an a or a b. Best regards Martin