February 20, 2011

How to do this?

The problem: you have a directory full of ".as" files, which are pure text. (They're Flash actionscript.) You need to find the one that contains a certain text string, which might include kanji or might be normal roman letters. It could even be just a number. (I can live without being able to search for Japanese text, but it would be nice to have.)

How do you search them to find that one?

In XP, Windows Search could search the contents of files as well as the filenames, but in Win7 I can't find any way to do that. Is there some other utility available with the  OS which can do it? Or is there some utility I can download which will do it?

This is a job for grep! Except that I don't know where to find that, either. (I used to have those for Win, but that was about four computers ago and I don't know whether I have backups going that back that far.)

UPDATE: Here's what doesn't work: Organize -> folder and search options -> Search -> Always search file names and contents

It seems that Windows search doesn't recognize .as as a text file extension, so it doesn't search inside them even if you tell it to.

And I do have indexing enabled, and this directory is indexed. Doesn't help.

UPDATE: I found my archive for Arcturus, the HP workstation, and I didn't backup that particular directory. Rats.

Posted by: Steven Den Beste in Computers at 11:39 AM | Comments (26) | Add Comment
Post contains 247 words, total size 1 kb.

1 Erk.  Is this a solicitation for advice, or just a rant? 

Windows search is one of the most spectacularly useless things in the entire OS, right up there with "diagnose network problem." 


Posted by: Douglas Oosting at February 20, 2011 11:50 AM (N9Lwt)

2 I use wingrep (wingrep.com) for this kind of thing. I'm not certain it supports kanji searches, but it should give you what you're looking for.

Posted by: bkw at February 20, 2011 11:50 AM (34O+x)

3 OK, I'll give WinGrep a try!

Posted by: Steven Den Beste at February 20, 2011 12:03 PM (+rSRq)

4 Well, it works, but man is that a clumsy interface. Anyone got anything better?

Posted by: Steven Den Beste at February 20, 2011 12:14 PM (+rSRq)

5 Cygwin runs a unix shell on top of windows, gives you all the commands you'd expect.

Notepad++, as well as being an excellent mutli-doc editor, has a 'search in files' function that is very robust.

Both of these are GPL freeware...and *should* be unicode-aware.  (I've never had to search for kanji, so I can't speak to that)

HTH.

Posted by: Douglas Oosting at February 20, 2011 12:51 PM (N9Lwt)

6 Real grep (also awk, diff, tar, etc) is available as part of the gnuwin32 packages. Searching for kanji works with these tools, but the standard cmd.exe window has display and encoding issues. One workaround is to put the kanji you're searching for into a file and then pass that to grep with the -f option.

(this is not like the pseudo-Unix Cygwin environment; they're just standard Windows command-line tools in a normal shell, which is much easier on the brain)

-j

Posted by: J Greely at February 20, 2011 12:55 PM (2XtN5)

7
JGreely(this wrote:



Unless the enemy has studied his Agrippa...which...no, wait, wrong context.  If one has already climbed the learning curve of cryptic commands and sh behavior, it's easier.  All about the tool that works best for the user!

Posted by: Douglas Oosting at February 20, 2011 01:07 PM (N9Lwt)

8
JGreely wrote:

(this is not like the pseudo-Unix Cygwin environment; they're just standard Windows command-line tools in a normal shell, which is much easier on the brain)



Unless the enemy has studied his Agrippa...which...no, wait, wrong context.  If one has already climbed the learning curve of cryptic commands and sh behavior, it's easier.  All about the tool that works best for the user!

Also, PIMF.  *sighs*

Posted by: Douglas Oosting at February 20, 2011 01:08 PM (N9Lwt)

9 When someone says "this is a job for grep!", it's safe to assume Knowledge Of The Hidden Mysteries.

Also, Cygwin is equal parts evil and suck, and has no place on a modern Windows box.

-j

Posted by: J Greely at February 20, 2011 02:16 PM (2XtN5)

10

At Tektronix, I started using Unix in 1978, on a PDP-11/45. We were running what was known as "V7", which means version 1.7. This was the era in which saying "Berkeley mods" to another user of Unix resulted in a knowing nod. (And yeah, we installed Berkeley mods.)

When I lived in Boston, late 1980's, my internet provider was "Software Tool and Die", and what they ran was Unix. You purchased the right to access their system and use it.

I also used Unix on Sun 3 workstations about 1985 when I worked at BBN.

Don't lecture me about Hidden Mysteries; I was doing them likely before you were born. (Damned kids.)

Anyway, a lot of my objections to WinGrep was the awfulness of using its menus to find the directory. When I posted that I hadn't noticed that they tossed in a right-click menu choice, which drastically improves the usability. It does what I need it to do, so I think I'll stick with it.

Posted by: Steven Den Beste at February 20, 2011 03:52 PM (+rSRq)

11 To the extent that I would have trouble with the Hidden Mysteries these days it would mostly be due to brain decay. I just don't think as well now as I once did.

Posted by: Steven Den Beste at February 20, 2011 03:58 PM (+rSRq)

12 "Hidden Mysteries"?

Posted by: metaphysician at February 20, 2011 04:20 PM (hD30M)

13

If we told you, we'd have to kill you.

Posted by: Steven Den Beste at February 20, 2011 04:27 PM (+rSRq)

14 Windows has an equivalent to grep built in, findstr. findstr /i "string" *.as /i is "ignore case" and there are a bunch of other parameters. If you want to search for a string, you use /c:"search these words", or else it will search for any of search, these, or words.

Posted by: RickC at February 20, 2011 06:08 PM (YB9ey)

15 Rick, how much you want to bet it only works on file extensions that Microsoft knows are text?

Posted by: Steven Den Beste at February 20, 2011 06:57 PM (+rSRq)

16 well, I don't know what I did wrong, but it just hung. No CPU usage, no response, no nothing until I hit Control-C. I rate that one a fail. Anyway, WinGrep already solved the problem, so I don't need any more suggestions.

Posted by: Steven Den Beste at February 20, 2011 07:00 PM (+rSRq)

17

"Rick, how much you want to bet it only works on file extensions that Microsoft knows are text?"

Nothing at all--I literally use it all the time.  It's entirely unrelated to Windows Search, so it doesn't have that limitation.

It's NOT a grep clone, however--the syntax is different, and it won't give you a nice progress bar or anything, so if it's scanning thousands of files, or a large amount of data or whatever, it will certainly APPEAR to hang.

 

Posted by: RickC at February 20, 2011 07:16 PM (YB9ey)

18 It was in a directory with only ten files, and the CPU use meter showed 2%, which is what it shows when the system is idle.

Posted by: Steven Den Beste at February 20, 2011 07:42 PM (+rSRq)

19

I bet it was waiting for input. I didn't specify any file names, and I bet it was waiting for STDIN.

But I don't really care enough to do any more experimenting with it.

Posted by: Steven Den Beste at February 20, 2011 08:03 PM (+rSRq)

20

Aziz wrote to tell me that you can add file extensions to the list of those that indexing processes:

http://www.howtogeek.com/howto/windows-vista/add-a-new-file-type-to-indexing-in-windows-vista/

Posted by: Steven Den Beste at February 20, 2011 11:04 PM (+rSRq)

21 But be warned: as soon as you do it, the indexing service kicks in and indexes all of your hard drives -- and the damned window can't be minimized. (I've got it mostly slid off the screen just to get it out of the way, and I suspect I'll have to leave my computer turned on all night.)

Posted by: Steven Den Beste at February 20, 2011 11:16 PM (+rSRq)

22 10^100 Desktop is often effective.  The downside is obvious.I'll check out findstr, with thanks.

Posted by: amarigatachi at February 21, 2011 04:15 AM (smT8Q)

23

Steven, yeah, if you didn't specify any file names, it was waiting for a list of them on stdin, which IIRC is the same thing grep does.  Glad you found a workable solution.

 

Posted by: RickC at February 21, 2011 02:11 PM (NatD7)

24

Just thought I'd mention: this morning Security Essentials informed me that I was infected with an adware package called "Win32/Opencandy". I think that it might have been a hidden gift from when I installed WinGrep yesterday afternoon.

Posted by: Steven Den Beste at February 21, 2011 02:18 PM (+rSRq)

25

Actually, it looks like it was MediaInfo that did that. I told Security Essentials to do a full scan, which took about three hours.

MediaInfo still seems to work, which is nice.

Posted by: Steven Den Beste at February 21, 2011 07:22 PM (+rSRq)

26 Yeah, I installed MIRC (IRC client) the other day and got warning about the same thing.  IIRC it was a low risk item.

Posted by: RickC at February 22, 2011 04:53 PM (YB9ey)

Hide Comments | Add Comment

Enclose all spoilers in spoiler tags:
      [spoiler]your spoiler here[/spoiler]
Spoilers which are not properly tagged will be ruthlessly deleted on sight.
Also, I hate unsolicited suggestions and advice. (Even when you think you're being funny.)

At Chizumatic, we take pride in being incomplete, incorrect, inconsistent, and unfair. We do all of them deliberately.

How to put links in your comment

Comments are disabled. Post is locked.
17kb generated in CPU 0.01, elapsed 0.0223 seconds.
20 queries taking 0.0096 seconds, 43 records returned.
Powered by Minx 1.1.6c-pink.