Skip to main content
1-Visitor
April 26, 2011
Question

"Find in Files"

  • April 26, 2011
  • 2 replies
  • 885 views
The customer, who is used to UltraEdit, wants a "Find in Files" menu
pick in their Arbortext Editor to search for a character string in
files on the file system. Does anybody know of a good way to do this?



Todd Hicks
Manager, Editorial Desktop Tools - Content Technology
Wolters Kluwer Global Platform Organization
(415) 868-2024 (HomeOffice@US Pacific Time)
todd.hicks@wolterskluwer.com
<blocked::<a style="COLOR:" blue;=" text-decoration:=" underline&quot;=" target="_BLANK" href="mailto:todd.hicks@wolterskluwer.com">">mailto:todd.hicks@wolterskluwer.com>



    2 replies

    18-Opal
    April 26, 2011
    Hi Todd-



    That could get a little involved, depending on what sort of features the
    user expects for this. The basic approach would be something like this
    (assuming that they are interested in simple text search, without trying
    to parse XML documents):



    1) Get the file list, probably using some combination of
    file_selector() and glob()

    2) Load each file as text, search for string; if found, add to
    "hits" list

    3) Report hits to user



    Presumably the user would like an easy way to select from the list of
    hits to open specific files and view them. That's where the "involved"
    part comes in, you might end up having to do a custom XUI or something
    to make that work. The customer would also probably want special
    handling for XML files versus other kinds of files (at least that's what
    I'd want if it were me).



    Plus, it would most likely involve either customizing the OOTB Find
    dialog or creating your own custom search dialog with controls to let
    the user specify their file selection criteria and any other options you
    want to provide.



    I guess you and your customer will ultimately have to decide for
    yourselves, but from my perspective, I'm not sure the value here would
    be worth the cost of developing the customization. Personally, when I
    want to do a "find in files" type of search I just switch to my text
    editor and do it there. The text editor (jEdit in my case) has this
    feature already implemented and tested, and has a slick interface for
    managing the search results.



    --Clay



    Clay Helberg

    Senior Consultant

    TerraXML


    1-Visitor
    April 28, 2011
    Just to throw out another, similar option:
    You could grab the Windows port of grep[1] and try to use that with the following workflow:
    1. The the term, filelist or wildcard selector.2. Run grep from the command line, pipe the output to a text file.3. Parse that file and display it to the user.
    1.