I had this happen accidentally a couple years ago. I flew a trip on AA, and booked it on AA.com under my AAdvantage number to get the online booking bonus.
I was working toward status on AS at the time, and at each check-in I presented the AAgent with my AS card and asked to have the account number changed accordingly.
The segments posted to both accounts within a few weeks. I left it alone, as I didn't do it on purpose and didn't want the hassle of explaining it to the airlines and risking them not believing me.