?
Solved

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

Posted on 2006-11-09
3
Medium Priority
?
208 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
  • 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 1500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Progress
Screencast - Getting to Know the Pipeline

749 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