Linker IT Software
Google
Web www.oraxcel.com
menubar-top-links menubar-top-rechts
Home Help Search Login
Welcome, Guest. Please Login.
SQL*XL: Database to Excel bridge litLIB: Excel power functions pack ExcelLock: Locking and securing your valuable Excel spreadsheets encOffice: Protect your Excel file easy and safe encOffice: Protect your Excel file easy and safe
Pages: 1
Recursive search for files not containing text (Read 4120 times)
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
Recursive search for files not containing text
09.02.08 at 22:54:22
 
recursive search for files not containing text
 
To do a recursive (looking into sub directories as well) search for files that do not contain a certain text I used the following command in Linux:
 
find . -name "*.htm" | xargs grep -iL "title"
 
Explanation:
The find command starts in the current directory (.) and searches for files with filename (-name) *.htm. All files named anything dot htm are found.
The result is a file list that is piped to the xargs utility to turn it into a file again. Without the xargs command the grep utility would work on the file name instead of on the file itself.
The grep command looks for the word title in the file. It looks case incensitive (-i) and it only prints the name of the file if it cannot find the text (-L).
Back to top
 
 

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
Re: Recursive search for files not containing text
Reply #1 - 05.07.09 at 20:22:45
 
A little easier (as far as syntax is concerned)way to do this recursive grep:
 
find . | grep htm | xargs grep -iL "title"
Back to top
 
« Last Edit: 05.07.09 at 20:23:16 by Gerrit-Jan Linker »  

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Pages: 1