The site apparently serves .csv directly as well (replace .zip with .csv). I used this to convert the expression to powershell (using only built-in powershell cmdlets and commands):
$> (invoke-webrequest "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.csv").Content
| ConvertFrom-Csv
| sort "usd"
| select "date" -first 1
Date
----
2000-10-26
Doing it with a zip file would be a little more verbose since there is no built in "gunzip" type command which operates on streams, but you can write one which does basically that out of built in .Net functions: function ConvertFrom-Zip {
param(
[Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)]
[byte[]]$Data
)
process {
$memoryStream = [System.IO.MemoryStream]::new($Data)
$zipArchive = [System.IO.Compression.ZipArchive]::new($memoryStream)
$outputStreams = @()
foreach ($entry in $zipArchive.Entries) {
$reader = [System.IO.StreamReader]::new($entry.Open())
$outputStreams += $reader.ReadToEnd()
$reader.Close()
}
$zipArchive.Dispose()
$memoryStream.Dispose()
return $outputStreams
}
}
and call it like: # unary "," operator required to have powershell
# pipe the byte[] as a single argument rather
# than piping each byte individually to
# ConvertFrom-Zip
$> ,(invoke-webrequest "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip").Content
| ConvertFrom-Zip
| ConvertFrom-Csv
| sort "usd"
| select "date" -first 1
Date
----
2000-10-26
I love powershell