Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Create multidimensional array from text file and search variable in first row next change value in second row.

$
0
0

I have text file separated by space (C:\test.txt), all values in row1 are unique:

Test1 100

Test2 200

Test3 300

next create array:

$arr = @(get-content  "C:\test.txt)

how can I find value from row1 = Test2, display value from row2 (200) next check if that value is greater than $variable1 if yes change that value to 200+100 and write that to array and next to file c:\test.txt ?

$variable1 = 150

array and test.txt should be when script ended:

Test1 100

Test2 300

Test3 300

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles