Daily Archives: August 22, 2019

Searching for a word in files across all subfolder in linux

Issue the Below command in the Linux terminal where /u01/test is the path to be searched.

$ grep -rnwi ‘/u01/test’ -e ‘CUST_LEAVE_DETAILS_V’ >> CUST_LEAVE_DETAILS_V.txt

  • -r or -R is recursive,
  • -n is line number, and
  • -w stands for match the whole word.
  • -l(lower-case L) can be added to just give the file name of matching files.

> CUST_LEAVE_DETAILS_V.txt will write the output of the command returned to a file name CUST_LEAVE_DETAILS_V.txt

source

 

 

Design a site like this with WordPress.com
Get started