I have generated multiple
.bash_history files by switching between snapshots on a VM. I would like to recover all these files into the single live
.bash_history file in my currently running instance.
The files have timestamps in them and I would like to preserve them as much as possible. However, it looks like some lines don't have timestamps on them. For example:
#1542817796 vi ~/.bash_profile set +x cd - cd w/Edge-Agent/edge-agent-ged/ make set -x man make make -npq make -npq .DEFAULT make make ack npq /etc ack npq /usr/share/ set +x ack npq /usr/share/ sudo vi /usr/share/bash-completion/completions/make dv hg diff vi ~/.bashrc #1542826064 ls #1542826066 vi ~/.bashrc #1542826074 cd .. #1542826321
I would like to order the merged list by timestamp because I was switching back and forth between the snapshots and the files interleave with each other. If there's no timestamp available for a command we can infer it from the last timestamp before and the first timestamp after.