Date: Fri, 3 Nov 2017 16:12:42 -0400 From: "James B. Byrne" <byrnejb@harte-lyne.ca> To: "Polytropon" <freebsd@edvax.de> Cc: freebsd-questions@freebsd.org Subject: Re: Reconstruct a bash_history file Message-ID: <e327a5772b0e182b734551e52100fa8b.squirrel@webmail.harte-lyne.ca> In-Reply-To: <20171102214634.dc4877cf.freebsd@edvax.de> References: <cc029c227a6b8de747426ba4cf9a7066.squirrel@webmail.harte-lyne.ca> <20171102214634.dc4877cf.freebsd@edvax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
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@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e327a5772b0e182b734551e52100fa8b.squirrel>