Solved

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

Posted on 2006-11-09
3
182 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 85

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 85

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This is an explanation of a simple data model to help parse a JSON feed
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

809 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