Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash find line of code in a file/files, in directory

How can I go about finding the line:

 print("hello world)"

In a directory x/y/z where the file/files could be in any branch of x's tree (where directory x has many children folders

like image 993
Barney Chambers Avatar asked Feb 07 '23 16:02

Barney Chambers


1 Answers

You can use recursive grep from parent directory of x:

grep -FR 'print("hello world)"' x/*
like image 164
anubhava Avatar answered Feb 16 '23 04:02

anubhava