1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Need a robust text find and replace utility - Like Ecobyte Replace Text 2.2 but not

Discussion in 'All Other Software' started by StumpedTechy, Jun 24, 2009.

Thread Status:
Not open for further replies.
Advertisement
  1. StumpedTechy

    StumpedTechy Thread Starter

    Joined:
    Jul 7, 2004
    Messages:
    7,234
    We have a TON of text based INI files for our companies software deployment scripts.

    We also have a TON of people who use different ways to deploy the same software. On one server alone we can have a bunch of different ways people install E.G.

    msiexec.exe /quiet /norestart /i \\dfs\dfsshare\SAV\Symant~1.msi
    msiexec.exe /quiet /norestart /i <qt/>\\server\share\WIN32\Symantec Client Security.msi<qt/>
    msiexec.exe /quiet /norestart /i \\server\share\SAV\WIN32\Symantec Client Security.msi
    msiexec.exe /quiet /norestart /i <qt/>\\dfs\dfsshare\SAV\Symantec Client Security.msi<qt/>

    and so on down the line.

    I LIKE the abilities of Ecobyte Replace Text 2.2 but the problem is I have to type in the whole line as it is in the file to then replace it with the new one for the new deployment.

    What I want to do is have a search based on PART of the line so I can then put in Symant~1.msi and Symantec Client Security.msi and replace the ENTIRE line with a new line.

    Is there any multi file utility that allows you to search for part of a text line but replace the entire text line?
     
  2. TheOutcaste

    TheOutcaste

    Joined:
    Aug 7, 2007
    Messages:
    9,028
    NoteTab can do that using a Regular Expression.
    CTRL+R to open the Search and Replace dialog.
    Check the Regular Exp. box
    Use this for the Search Expression:
    (.*Symant~1.msi.*)|(.*Symantec Client Security.msi.*)

    Then paste the new line into the Replace box; You need to paste the line so Notetab can escape any Regular Expression characters if needed.

    The free version will only work on files that are open in the program. The STD Version will work with files on disk.

    Ecobyte Replace Text 2.2 does support Regular Expressions, but I'm not familiar with it. I don't know if it can search for multiple search strings at the same time (called Alternation), but should be able to do each one separately.
    .*string.* should match the entire line for any line that contains string, which will let you replace the entire line. The period means match any character, the * means any number of characters, so that translates to anythingstringanything

    A batch file might be able to do it. Batch files really hate dealing with lines that have !, <, or > in them. Especially if there are quotes in the same line as well.
    A VBScript should be able to handle it though.
     
  3. StumpedTechy

    StumpedTechy Thread Starter

    Joined:
    Jul 7, 2004
    Messages:
    7,234
    Yeah I kinda figured bat was outta the question our scripting usinses <qt> and alot of other strange items in it. I was thinking of going VBS. I have tried everything wwith Exobyte even posting a few places with no help on hoe to use it and the help is one of the worst help files I have ever seen on a program.

    I'll give this a try in exobyte and try notetab though it looks as though you have to open each file and I really don't want to do that with thousands of files to go through.
     
  4. TheOutcaste

    TheOutcaste

    Joined:
    Aug 7, 2007
    Messages:
    9,028
    I'll have a go with Ecobyte and see if I can figure out it's Regular Expression syntax, maybe tomorrow.
    The free version of Notetab would require the files to be opened. The paid version does not. There is a 30 day trial that I believe is fully functional, so for a one time deal that might do the trick.
     
  5. TheOutcaste

    TheOutcaste

    Joined:
    Aug 7, 2007
    Messages:
    9,028
    Ecobyte will do it. It doesn't have a "match at beginning of line" option, so that took some figuring to keep it from matching multiple lines.
    I've attached screen shots of the Advanced Edit window, and the main window.
    The format to match an entire line containing a specific string is as follows:
    {}p[^{}e]*Text to search goes here[^{}e]*{}e

    • {}p - This says the line is a regular expression.
      It will be added when you choose to use a regular expression, or you can add it yourself. Not documented in the help file:(
    • [^{}e]* - Means match zero or more characters except Enter (CR/LF)
      The brackets denote a range, so shouldn't be escaped
    • Text to search goes here - the text to search for.
      The following characters must be escaped with a backslash:
      • Asterisk - \*
      • Backslash - \\
      • Braces {} - \{ and \}
      • Brackets [] - \[ and \]
      • Caret - \^
      • Dollar Sign - \$
      • Period - \.
      • Plus sign - \+
      • Question Mark - \?
    • {}e - Matches Enter (CR/LF)
    Since this does match the CR/LF at the end of the line, the replacement text must include a CR/LF.
    If you need two backslashes in the replacement text, you must enter three.
    This is the test file I used, followed by the result:
    Code:
    msiexec.exe /quiet /norestart /i \\dfs\dfsshare\SAV\Symant~1.msi
    msiexec.exe /quiet /norestart /i <qt/>\dfs\dfsshare\SAV\dumb program.msi<qt/>
    msiexec.exe /quiet /norestart /i \\dfs\dfsshare\SAV\Symant~1.msi
    msiexec.exe /quiet /norestart /i <qt/>\\server\share\WIN32\Symantec Client Security.msi<qt/>
    msiexec.exe /quiet /norestart /i \\server\share\SAV\WIN32\Symantec Client Security.msi
    msiexec.exe /quiet /norestart /i <qt/>\\dfs\dfsshare\SAV\Symantec Client Security.msi<qt/>
    msiexec.exe /quiet /norestart /i <qt/>\dfs\dfsshare\SAV\Norton Client Security.msi<qt/>
    msiexec.exe /quiet /norestart /i <qt/>\dfs\dfsshare\SAV\dumb program #2.msi<qt/>
    
    Code:
    New line for Symant~1 - msiexec.exe /quiet \\dfs\dfsshare\SAV\Symantec.msi
    msiexec.exe /quiet /norestart /i <qt/>\dfs\dfsshare\SAV\dumb program.msi<qt/>
    New line for Symant~1 - msiexec.exe /quiet \\dfs\dfsshare\SAV\Symantec.msi
    New line for Symantec Client Security - msiexec.exe /quiet /norestart /i <qt/>\\server\share\WIN32\Symantec Client Security.msi<qt/>
    New line for Symantec Client Security - msiexec.exe /quiet /norestart /i <qt/>\\server\share\WIN32\Symantec Client Security.msi<qt/>
    New line for Symantec Client Security - msiexec.exe /quiet /norestart /i <qt/>\\server\share\WIN32\Symantec Client Security.msi<qt/>
    msiexec.exe /quiet /norestart /i <qt/>\dfs\dfsshare\SAV\Norton Client Security.msi<qt/>
    msiexec.exe /quiet /norestart /i <qt/>\dfs\dfsshare\SAV\dumb program #2.msi<qt/>
    
    EcoMain.JPG
    EcoAdv1.JPG

    I haven't done a lot of testing, so there may be some other quirks depending on what is in your files, but this should work.
    Always a good idea to test on some samples first, or be sure to use the backup feature.

    Jerry
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/837870

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice