Reconstruct a bash_history file
James B. Byrne
byrnejb at harte-lyne.ca
Fri Nov 3 20:12:51 UTC 2017
On Thu, November 2, 2017 16:46, Polytropon wrote:
>
> This version is easier to read:
>
> cat history.txt | while read LINE; do
> DATETIME=`echo $LINE | cut -d ':' -f 1-3`
> TIMESTAMP=`date -j -f "%Y-%m-%d %H:%M:%S" "${DATETIME}" "+#%s"`
> COMMAND=`echo $LINE | cut -d ':' -f 4-`
> echo "${TIMESTAMP}"
> echo "${COMMAND}" | sed "s/^ //"
> done > bash_history.txt
>
> It features the "useless use of cat" line the one-liner. ;-)
>
Worked great. Thank you very much. I have added this one to my daybook.
--
*** e-Mail is NOT a SECURE channel ***
Do NOT transmit sensitive data via e-Mail
Do NOT open attachments nor follow links sent by e-Mail
James B. Byrne mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3
More information about the freebsd-questions
mailing list