Listing files with string not found

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
bowlesj
Forum Contributor
Posts: 179
Joined: Fri Jul 18, 2014 1:54 pm

Listing files with string not found

Post 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
bowlesj
Forum Contributor
Posts: 179
Joined: Fri Jul 18, 2014 1:54 pm

Re: Listing files with string not found

Post 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.
Last edited by bowlesj on Wed Jan 21, 2015 8:17 am, edited 2 times in total.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Listing files with string not found

Post 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.
bowlesj
Forum Contributor
Posts: 179
Joined: Fri Jul 18, 2014 1:54 pm

Re: Listing files with string not found

Post 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
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Listing files with string not found

Post by Christopher »

I use these grep options all the time, they are very handy to know:

-L, --files-without-match

-v, --invert-match
(#10850)
bowlesj
Forum Contributor
Posts: 179
Joined: Fri Jul 18, 2014 1:54 pm

Re: Listing files with string not found

Post 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
Post Reply