Skip to main content
1 vote
1 answer
33 views

Format Select-String output (path:linenumber:line)

I want to modify the following output from Select-String \\path-to-logfile\copy2xl.log:390:NOTE: At least one W.D format was too small for the number to be printed. The decimal may be shifted by the &...
data _null_'s user avatar
  • 9,129
2 votes
2 answers
132 views

PowerShell code not returning correct or enough values in string

Good evening. Stack Overflow and Powershell and RegEx novice here. The below Powershell code is returning some but not enough parts of the string to make a visual verification. It might be returning ...
BigSmooth82's user avatar
2 votes
1 answer
137 views

PowerShell code returning more values than expected

Good evening. Stack Overflow and Powershell novice here. The below piece of code in Powershell is returning more values than I wanted. For example, it is capturing variables in a JSON file that match ...
BigSmooth82's user avatar
1 vote
1 answer
87 views

PowerShell command to extract `<ProjectReference Include=(...)` from all `.csproj` files in a directory and its subdirectories

Get list of .csproj in directory and subdirectories of D:\repos\M\Test [1] PS D:\repos\M\Test> ls -r -filter "*.csproj" | select Directory, Name Sample output Directory ...
joseville's user avatar
  • 973
0 votes
2 answers
338 views

How to make PowerShell `Select-String` aka `sls` output exact match(es) only?

In a PowerShell script, I would like to check if a branch exists locally already, which I'm currently doing as $existsInLocal = (git branch | sls $branch) -ne $null, but that's incorrect because sls $...
joseville's user avatar
  • 973
0 votes
2 answers
71 views

PowerShell move all files containg exact string in their body

This is somewhat based on: Powershell Move Files With Matching Substrings In that question, the concern is to move files with substrings in the file title to the subdirectory. In my case, I want to ...
JosephDoggie's user avatar
  • 1,604
1 vote
1 answer
235 views

How to Handle Select-String returning System.Object[]

I am aware of this question. It doesn't quite answer my question (or I'm failing to understand how to apply it). I am attempting to search a selection of files in a directory for strings that may be ...
Travis's user avatar
  • 1,105
4 votes
2 answers
168 views

Select-String: match a string only if it isn't preceded by * character

I have this line in a Powershell script: if (Select-String -Path "$holidays" -Pattern "(?<!\*)$datestr" -SimpleMatch -Quiet) $holidays is a text file where i have some date: ...
Fryc's user avatar
  • 143
0 votes
1 answer
121 views

Need to get Line number of Select-String mactch

realy need your help. I have a $combobox that gives me all the FileName that contain "wrong source". <$ComboBox.Items.AddRange(@(Get-ChildItem $filepath -Recurse -Include ".xml",...
J C's user avatar
  • 43
1 vote
2 answers
194 views

How do I convert from HEX to dec having select-string outputs

I'm stuck at a powershell problem - I need to get current active power scheme, precisely Turn off display after ... setting. I have the HEX settings from powercfg select-object, but I can't seem to ...
tomaito's user avatar
  • 41
2 votes
1 answer
232 views

Using Powershell runspaces to search large number of files (.XML)

I have a script that will look for a regex inside a large number of files, such as an address or phonenumber. The script i currently have runs as a job and works, however very slowly. Currently my ...
iva hardy's user avatar
1 vote
1 answer
60 views

Select-String RegEx how to select only '}' in this example

Lets say I have string like so: foo } bar} } {baz} and I only want to match closing braces that are at the start of a line or are preceded by a white space such as one or more tab characters. ...
Ralf_Reddings's user avatar
1 vote
2 answers
129 views

find string in file from last saved position - PowerShell

I wrote a simple PowerShell script, to find specific string in a given text file, using the Select-String cmdlet: $SearchResult = $null $FilePath = "c:\temp\app\events.log" $FindString = &...
edwio's user avatar
  • 333
1 vote
2 answers
814 views

How to display values from a powershell array created by select-string

I have an array and use select-string to find duplicates. $2 = $arraySNOW | Select-String -Pattern $request The process usually finds 2 items and but each item is now rapped inside @{} object and I ...
Tihomir Buncic's user avatar
0 votes
1 answer
55 views

Why this Powershell Regex for serial numbers returns everything with Select-String?

I'm trying to get the first serial number of Chromedriver from this string in Powershell with Select-String, but the regex returns everything: '\d{1,4}.\d{1,4}.\d{1,4}.\d{1,4}'. The regex works well ...
Noob_Number_1's user avatar

15 30 50 per page
1
2 3 4 5
17