I am greping a string from multiple files, but the one undesired side effect, is the filename prefacing the output. How can I suppress the filename outputs using only grep?
$ grep -i lp lpNet*
lpNet:This was printed via the internet using the lp command.
lpNet:I believe lp doesnt care what the device is.
lpNet1:This was printed via the internet using the lp command.
lpNet1:I believe lp doesnt care what the device is.
lpNet2:This was printed via the internet using the lp command.
lpNet2:I believe lp doesnt care what the device is.
lpNet3:This was printed via the internet using the lp command.
lpNet3:I believe lp doesnt care what the device is.
I have solved the issue for now using cat lpNet* | grep lp I am just wondering if there is a more efficient path to have the same effect
The default behavior is to print the filename when given multiple file arguments - to suppress this, you can add the
-h
or --no-filename optionFrom the
Output Line Prefix Control
section of the grep manual page: