Find Duplicate character in each line

I have a output file with following data:

Need to find duplicate strings before “” and out the complete line to a new file. Tried few options, but most of the time no luck. Can soemone please help me on this?


You will have to be more specific. What have you tried so far? What does “most of the time no luck” mean? Please show your code (format it as code using the code tag button on the editor window (pre) ).
If you get error messages you should post these as well (formatted as code as well). A lot of times there’s already a hint or even the solution for the error inside the error message.

Use excel > apply conditional formatting > filter out them as per formatting, copy it paste into new file. Job will be done in a minute. Enjoy…

For the sake of doing it in Powershell:

$strs = (
$regex = [regex]::new("(?<=http:\/\/)(.*)(?=\.kalyan\.com)")
$strs = $strs |
for ($i = 0; $i -lt $strs.Count; $i++) {
if (
($current-eq $($regex.Match($strs[$i+1]).Value)) -or
($current -eq $($regex.Match($strs[$i - 1]).Value))

May be like this

$PropertyList = @{E={ $null = $_ -match 'http://(.+)\.kalyan.+';$matches[1]};L='Child'},@{E={$_};L='Content'}
Get-Content -Path C:\Temp\TestUrl.txt | Select-Object -Property $PropertyList | Sort-Object -Unique -Property Child