Find multiple strings with one search and output them to a file

Find multiple strings with one search and output them to a file

1
NewbieNewbie
1

    Sep 16, 2009#1

    Hi,

    I tried to search forum for this but had a hard time to find what I was looking for.
    If anyone could point me to some existing post on this forum, it would be great.
    I am trying to find a way to search for multiple strings of data at the same time, for example DATETIME, SYNTAX, DECLARE, in q file with more then 1 million rows and if possible extract those lines which contain one of those strings to a file with a line number.

    Thanks

    6,687586
    Grand MasterGrand Master
    6,687586

      Sep 17, 2009#2

      If you need this only once, do following after opening the file:
      • Press Ctrl+F to open the Find dialog.
      • Enter in Find What the string word 1|string 2|word3|string4 .
      • Check the option Match Case if it is not important to search not case sensitive. A case sensitive search is faster than a search ignoring the case of letters.
      • Check the option Regular Expressions which is required for this search because | is a Perl regular expression character which means OR.
      • Click on button Advanced if you do not already see the advanced options.
      • Select the regular expression engine Perl which is the only regexp engine supporting more than 2 arguments in an OR expression.
      • Check the option List Lines Containing String.
      • Find Where should be set to Current File and the other 3 options should not be enabled.
      • Run the search now with pressing button Next.
        A dialog opens showing you the lines with one of the words / strings you entered.
      • If you don't see the line numbers in this dialog, check the option Show Line Numbers in the bottom right corner of the dialog.
      • Press the button Clipboard to copy what you see in the dialog to the clipboard and close the dialog with a click on button Close.
      • Press Ctrl+N to open a new file and press Ctrl+V to paste into the new file the just copied lines with the line number.
      That's it. If you need this often, it would be better to do the same with a script or a macro. There are already some macros and scripts for the List Lines Containing String feature in the macro and script forums.

      Update: Take also a look on find strings with a regular expression and output them to new file which is a very fast scripting solution for such a task.
      Best regards from an UC/UE/UES for Windows user from Austria

      3
      NewbieNewbie
      3

        Sep 28, 2009#3

        I have a somewhat similar problem that I am having difficulty with. I have an environment where I'm regularly trying to locate all source members of a project (over 1,900 members) of a given set of strings. for instance... $810blah|$910blah|$verblah I have tried using the Find In Files, setting to regular expression search (perl engine) and putting the string exactly as shown above. I yeild no results. although I know there are many but need to get an exhaustive listing of them. I have tried unsuccessfully many different types but have come up empty. Can you give me a boost on this? Thanks -- Paul

        6,687586
        Grand MasterGrand Master
        6,687586

          Sep 29, 2009#4

          The character $ has a special meaning when running a regular expression search, see in help of UltraEdit the page Regular Expressions (Perl Style). It means end of line. So you have to put the escape character \ left to every $ to force the engine to interpret the character $ as character $ and not as end of line anchor. Your search string must be therefore \$810blah|\$910blah|\$verblah
          Best regards from an UC/UE/UES for Windows user from Austria

          3
          NewbieNewbie
          3

            Sep 30, 2009#5

            Thanks! :)