Skip to main content

All Questions

Tagged with
0 votes
2 answers
55 views

Splitting data with powershell

I have a wonderful little script that returns just what I needed at the time. But things change and now I need to add to my script. My powershell skills are limited. I have done some searching but not ...
JGaard's user avatar
  • 13
1 vote
2 answers
57 views

How can I split a block of text into multiline records based on the starting line?

How can I split this into separate strings/arrays/etc so that I can then iterate on each one separately? The goal is to separate them so that I can then parse each record and insert into a ...
xeric080's user avatar
  • 146
0 votes
2 answers
91 views

Powershell convert unordered Text to CSV

I have a system that exports a text file [.txt] and wish to convert the text to a .csv file. The export contains 500+ lines so manual manipulation in Excel is very slow. I have no means of changing ...
Root User's user avatar
0 votes
2 answers
186 views

Splitting strings based on regex expression

Is there a quick way I can split a string based on a regex expression match. Using Powershell This string "800G1" should read "800 G1" but when the string is found it just ignores ...
Iain Howard's user avatar
0 votes
0 answers
32 views

attached script takes hours to complete, can this be improved. Script scan single file line by line till last line , file has 80k plus lines [duplicate]

Here is sample of input file. There are 80k plus lines. I want only one pass thru file to avoid lengthy run. Is there way pass thru many times thru entire file and complete within 30 minutes ? Thank ...
postmaster 420's user avatar
0 votes
1 answer
50 views

how to make unique entry in array in hashtabe

I have following line in test1.txt bpdppa301p.corpads.local 86929680 JC_UNIX_FS01_INCR JC_FS UNIX_FS01_INCR incr 02/24/2022 03/30/2022 03/30/2022 disk 1645678800 backup 84 MB /dbwsrp01/dbwsrp01 ...
postmaster 420's user avatar
2 votes
1 answer
167 views

Is it possible in PowerShell to split a 4096 character variable into equal 1024 character parts? [duplicate]

I have seen this done in other languages, but I have not been able to achieve this yet in PowerShell. I am attempting to read in a device's HardwareID for importing into Azure. The HardwareID variable ...
Retoxx's user avatar
  • 33
0 votes
2 answers
1k views

Splitting and Adding String in Powershell

I have following issue: I have a string, like $word ='ABC.DEF.GHI' I want to split this String into an array at the dot and add a string instead. Desired outcome would be like: $arrayWordSplitted = '...
TheCodingKing's user avatar
1 vote
1 answer
8k views

Create an array from get-child item list quicky in PowerShell

I am trying to shorten my scripts and reduce the number of foreach I use. I have a list of items using Get-ChildItem and I'd like to split each filename and create an array from the total list. ...
Garrett's user avatar
  • 669
0 votes
1 answer
102 views

Powershell: How to Pipe Array of -Split Words into Command String

New here. So forgive me ahead of time. I have an Excel Spreadsheets which contains a list of Employee Names and their Job Titles, amongst other Employee data. I wrote a Powershell Script that copies ...
AngryITFurry's user avatar
0 votes
1 answer
327 views

Creating an Array From String in Powershell

I am getting a string passed in from Python into my powershell script via a string parameter. That string is a list of files that I need to copy from one machine to another. I use a for each loop to ...
Drake Owen's user avatar
0 votes
0 answers
111 views

PowerShell Array ForEach not parsing correctly

I am writing a simple script to parse a couple of arrays (one nested inside the other) and then run a pen port check against each port and port type. $ComputerList = 'dc-01' $PortArray ='3389 TCP','...
Aziz's user avatar
  • 293
1 vote
2 answers
269 views

Powershell - split string to array delineated by start and end strings

I have a multi-line string (from a json) like "somekey": "somevalue", "somekey": "somevalue" "somekey": [somevalue] "somekey": somenumber &...
user avatar
0 votes
2 answers
725 views

Powershell to split a string into an array by start and end characters

Given values to extract from a string, where each value is surrounded by a starting character and ending character, what would be the most effective way to achieve this? eg, to get an array containing ...
user avatar
6 votes
1 answer
7k views

How do I split a string in groups of 2 characters in powershell without delimiters?

I have a problem where I accept a string of number. I need to split the string into group of 2 numbers and perform arithmetic operations on them. I am aware of powershell -split operator but it doesen'...
vjx's user avatar
  • 73

15 30 50 per page