In UnixLinux Write a command to print the lines that contain

In Unix/Linux, Write a command to print the lines that contain the word \"object\" in all the files in a directory and also suppress the file names.

Solution

Linux Command : grep -C 0  \'object\' *

grep is powerful command line utility to search or find required pattern in current directory of all files.

grep means global/regular expression/print

-C indicate context

0 -- prints Zero lines of context around each matching line.

object -- searching pattern

*.* | * indicates all files in currest directory

Example output : grep -C 0  \'object\' *.*

Newfile.sh:object sdfdssdfds Newfile.sh:object slkfjsdlkfj   

main.sh:object fgf main.sh:objectslkflsdk

In Unix/Linux, Write a command to print the lines that contain the word \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site