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

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

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.
Answered 12/18/2009 by: airwolf
Tenth Degree Black Belt

Please log in to comment
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
Answered 12/18/2009 by: kiran_i_rao
Yellow Belt

Please log in to comment
0
A variation of this should work with a bit of modification.
Answered 12/18/2009 by: airwolf
Tenth Degree Black Belt

Please log in to comment
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.
Answered 12/18/2009 by: kiran_i_rao
Yellow Belt

Please log in to comment
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.
Answered 12/18/2009 by: airwolf
Tenth Degree Black Belt

Please log in to comment
Answer this question or Comment on this question for clarity