Solved

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

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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 …

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