Page 1 of 1
Listing files with string not found
Posted: Wed Jan 21, 2015 7:33 am
by bowlesj
Hi, This is a tough one to find on Google. I can't find it in notepad++ nor netbeans. Is there a utility that can search for files (webpages) that do not contain a string and list those files? I am currently hoping to find this under windows.
Thanks,
John
Re: Listing files with string not found
Posted: Wed Jan 21, 2015 8:02 am
by bowlesj
I found a sneaky way to do this.
1/ In notepad++ search files for the string you are after.
2/ right click in the search results box and click "Select all"
3/ right click in the search results box and click "copy"
4/ past this into a new notepad++ editor page.
5/ Use regular expressions to clear any stuff you do not want moved down to a blank line.
6/ use regular expressions to modify the files that are left into a move command "move "C:\whatever\whatever.php" "C:\TargetDirectory\"
7/ save this as a move.bat file
8/ run the move.bat file
9/ The files left in the original directory are the ones without the string.
10/ Put the moved files back.
A not found search would be much easier that the above but this is easier than checking 200 files for something missing.
Re: Listing files with string not found
Posted: Wed Jan 21, 2015 8:03 am
by Celauran
grep is really the tool you want to use. It's available under
cygwin. Alternately, you could list all files, list all files that
do contain the string, and then diff the results.
Re: Listing files with string not found
Posted: Wed Jan 21, 2015 8:21 am
by bowlesj
Thanks Celauran. It is amazing how we forget. I used to know (sed, awk, grep, bash from linux and ksh) sooooooooooo well about 15 years ago then I left the unix world and I will need to learn some of it all again pretty much fresh from the start.
John
Re: Listing files with string not found
Posted: Wed Jan 21, 2015 3:55 pm
by Christopher
I use these grep options all the time, they are very handy to know:
-L, --files-without-match
-v, --invert-match
Re: Listing files with string not found
Posted: Wed Jan 21, 2015 6:34 pm
by bowlesj
Thanks Christopher, I am going to install cygwin soon and try to learn enough to do this within the next 2 weeks. Back to the days of unix soon.
John