Need to import particular lines of a txt file and store as variables
I have
$One= Get-Content -path “D:\Testfolder\dir.text | Select -first -skip 3
As line 4 is stored into $One, likewise I want to store line 10 into $Two, 16 into $Three...until $Five. (In 4+6n format or -skip 3+6n)
I’ve tired
$x=0,6,15,21,24 For-each ($i in $x) {$One= Get-Content -path “D:\Testfolder\dir.text | Select -first -skip 3+$x }
But it’s invalid and doesn’t assign each value to different variable. I’m a complete beginner so bear with me please.
Posted Oct 29, 2020, 6:00 PM UTC · edited
19