Solved

Find and Replace Text in a Text File for multiple stings??

Posted on 2006-11-09
3
202 Views
Last Modified: 2010-04-16
Maybe I'm at a block here, but I need to have a script replace multiple stings in a file, or better yet, delete those stings and format a text file.  What I need is to display the path right after C:\ then delete everything but the User\Specific sting....  that said, a target seach would work from this, but I don't know how to run multiple queries..

http://www.microsoft.com/technet/scriptcenter/resources/qanda/feb05/hey0208.mspx



C:\IO.SYS BUILTIN\Administrators:F
          BUILTIN\Administrators:F
          NT AUTHORITY\SYSTEM:F
          BUILTIN\Users:F
          User\Specific

C:\Logon.log BUILTIN\Administrators:F
             NT AUTHORITY\SYSTEM:F
             BUILTIN\Users:F
             User\Specific

0
Comment
Question by:rtmcmullen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 17911051
Can you show us what the modified file should look like when we are done?...
0
 

Author Comment

by:rtmcmullen
ID: 17912426
I want to take out everything but the file after the C:\ and "User\Specific" stings.

So for example, on the above, it would be:

IO.SYS
User\Specific

and

Logon.log
User\Specific
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 17914569
Ok.

Speaking generically now...

Could there more more than two "blocks"?
If yes, do we only do the first two or the whole file?

Is there always a space inbetween the blocks?

Will we always keep the file from the first line of the block and only the last line of the block?
(The first block has 5 lines while the second has 4.)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Simple Linear Regression

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question