Forum Discussion
extract http data
OK, would you please post a sample of the text file you are reading from.
and also explain a bit more on how the result should look like
Just to give you a small hint, what you need to do is using Regex, but I will wait for your reply to confirm.
http://hdfcebank.com/jhgsfgdsf ;kkjhadsf;kjnsdf ;kkjhadsf;kjnsdf ;kkjhadsf;kjnsdf ;kkjhadsf;kjnsdf
http://hdfcebank.com/jhgsfgdsf ;kkjhadsf;kjnsdf ;kkjhadsf;kjnsdf ;kkjhadsf;kjnsdf ;kkjhadsf;kjnsdf ;kkjhadsf;kjnsdf
http://cart.com/jhgsfgdsf ;kkjhadsf;kjnsdf ;kkjhadsf;kjnsdf
http://hdfcebank.com/jhgsfgdsf kuhsdfkhdsf
http://hdfcebank.com/jhgsfgdsf uhsfdhkjlsfd
lksdfsdkndsf
;lnskfdkjnsdf
hblshdfkjhdfs
- Shree2280Jan 27, 2021Brass Contributor
- farismalaebJan 27, 2021Steel Contributor
I had created a file and add the sample you provide
and using this code, was able to get the result with only http://websitename without spaces
$items=(($x=Get-Content -Path C:\test.txt).split(";") | where {$_ -like "http://*"}) foreach ($item in $items){ ($item.split(" "))[0] }