This is a bit messy, but it should work to an acceptable level if you have gawk installed:
echo `echo $USER | awk '{print toupper($0) "'"'"'S"}'` "SHELL HISTORY UNWRAPPED" `date +%Y` && history | gawk '{gsub(/^\s*[0-9]+\*?(\s*[0-9/T:]+)\s+/, "", $0); print $0}' | gawk '{gsub(/ \| /, "\n", $0); print $0}' | gawk ' { i=2; while ($1 ~ /^[A-Z0-9_]+=/) { $1=$i; i++ }; print $1 }' | sort | uniq -c | sort -n | tail -n 10
Mastodon server of https://doma.dev.
@jonn regexes will do that to an operator