Here is how to find all accounts with an E5 license:
get-msoluser -maxresults 1000 |?{($_.islicensed -eq $true) -and ($_.licenses.accountskuid -like "*e5*")}
Here is how to bulk remove everyone with an E5 license (Careful! Be sure you want to do this):
get-msoluser -maxresults 1000 |?{($_.islicensed -eq $true) -and ($_.licenses.accountskuid -like "*e5*")} | set-msoluserlicense -RemoveLicenses "domain-here:SPE_E5"