Consider the following command:
ls
dir1 dir2 file1
x1 x2 y2
when this output is piped into e.g. grep each file/directory is processed as an 'item'.
ls | grep f
file1
So obviously there is a distinction between the actual output that a ls
produces and the input that is processed by grep.
Since grep operates on lines one could expect that ls | grep f
would show the whole first line, namely: dir1 dir2 file1
What am I missing here? What is the mechanism behind this behavior?
ls
) manual... The default format shall be to list one entry per line to standard output; the exceptions are to terminals or when one of the-C
,-m
, or-x
options is specified. – don_crissti Jul 11 '16 at 12:29