When I enter ls
command I get the below output.
-$ ls
aNode ANode bNode BNode cNode CNode DUMP file1 hello.txt TEST.txt
-$
As seen, above output is one
line which has filenames
separeted by spaces
.
Next when I use grep
to find a match.
I was expecting that if a match is found then the entire line will be printed.
But, on the contrary, grep only prints the match but not the entire line containing the match. Please see below.
-$ ls | grep 'aNode'
aNode
-$
Why is this happening ? Why is grep
not printing the entire line ?