Remapping the order of -/_ key I have found lots of answers about remapping one key to another('A' to 'B')but cant seem to find how to swap the order of a single key so that shift+(-/) gives me a dash(-) and a single press alone give me an underscore (). I would prefer a command line DIY solution (like Technical Note TN2450 https://developer.apple.com/library/content/technotes/tn2450/_index.html) than having to download a program.
Seen that you prefer cmd line solution but I would like to suggest you to try Karabiner, I'm using it for ages and it is really powerfull.

Karabiner


  A powerful and stable keyboard customizer for macOS.


https://pqrs.org/osx/karabiner/