/build/static/layout/Breadcrumb_cap_w.png
02/27/2017 658 views

I have a text file whose data will be as below.

win10x64 ~\erwin Notallowed1! "erwin Data Modeler r9.7 (32-bit)_2500.exe" SilentInstall.exe
win10x64clone1 ~\erwin Notallowed1! "erwin Data Modeler r9.7 (64-bit)_2500.exe" DM64.exe
win10x64clone2 ~\erwin Notallowed1! "erwin Mart Server r9.7 (32-bit).exe" SilentInstall.exe
win10x64clone3 ~\erwin Notallowed1! "erwin License Server r9.7 (32-bit).exe" SilentInstall.exe

Each line will have multiple values separated by space.

If a value contains space in it, the value is surrounded by quotes.

My task is to check how many values are there in each line.

If the line contains 5 values, I need to replace the 4th value with the string contained in a variable.

If it contains 4 values then also  I need to replace the 4th value followed by appending 5 th value to it as SilentInstall.exe

If the value I am replacing contains spaces then I need to surround the new value with quotes.

 

Any one can suggest how to do this,??

0 Comments   [ + ] Show comments

Comments



Community Chosen Answer

1
You could start with the Split method, I guess.
Answered 02/28/2017 by: VBScab
Red Belt

All Answers

0
Got solution with AutoIT.

But we need to implement this in Powershell.

At present I am calling the autoit exe from powershell script as a temporary solution.

Please find the script link below.

Answered 03/01/2017 by: ur00361883
Black Belt