Find Duplicate character in each line

Hi,
I have a output file with following data:
URL
http://cool1.kalyan.com/asp1
http://test.kalyan.com/asp1
http://cool1.kalyan.com/asp10
http://care.kalyan.com/asp2
http://cool1.kalyan.com/asp15

Need to find duplicate strings before “.kalyan.com” 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?

-Kalyan

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) ).
Thanks
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 = (
"http://cool1.kalyan.com/asp1",
"http://test.kalyan.com/asp1",
"http://cool1.kalyan.com/asp10",
"http://care.kalyan.com/asp2",
"http://cool1.kalyan.com/asp15"
)
$regex = [regex]::new("(?<=http:\/\/)(.*)(?=\.kalyan\.com)")
$strs = $strs |
Sort-Object
for ($i = 0; $i -lt $strs.Count; $i++) {
$current=$regex.match($strs[$i]).Value
if (
($current-eq $($regex.Match($strs[$i+1]).Value)) -or
($current -eq $($regex.Match($strs[$i - 1]).Value))
)
{
$strs[$i]
}
}

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