/build/static/layout/Breadcrumb_cap_w.png

text file editing

Hi,

I have a requiredment where i need to read one line in a text file, compare it with a string and replace the next 4 lines with another set of 4 lines. Can some one tell me how to go about it.

Regards

0 Comments   [ + ] Show comments

Answers (5)

Posted by: airwolf 14 years ago
Red Belt
0
Which scripting language(s) are you familiar with? A fairly simple AutoIT script could be written to perform this task, and VBScript would be a viable option as well - there are other scripting languages you could also use. If you require assistance with a script, then post your source code so we can help you out. If you're asking someone to write the script for you, then good luck. You may be able to find something similar to this that you can tweak a bit to your needs. If you are up for using AutoIT, then search their forums and I'm sure you'll find something to suit your needs.
Posted by: kiran_i_rao 14 years ago
Yellow Belt
0
Hi,

I prefer vb script to perform this action. What i am trying to achieve is i need to search fora specific line in multiple files and modify the next 3 lines in each of those files.

Regards
Posted by: airwolf 14 years ago
Red Belt
0
A variation of this should work with a bit of modification.
Posted by: kiran_i_rao 14 years ago
Yellow Belt
0
Thank you for your quick reply.
this script works fine if you searching for a line and replacing the same line.
BUt while trying to replace the next line, this doesnt work.
Posted by: airwolf 14 years ago
Red Belt
0
Right, it will take a bit of modification, but not much. Are you or any of your coworkers familiar with VBS? If not, you may need to do some reading about the basics - and you may be able to find some other scripts to chop up by doing some Googling. I found that article by Googling "vbs find replace". You just need to modify it to replace the next few lines after the search return... So you'd perform the search, assign the line # found to a variable, and then do a few WriteLines to $variable + 1, $variable + 2, etc.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ