[colug-432] Trimming Date, Time, and Command Number from History

jep200404 at columbus.rr.com jep200404 at columbus.rr.com
Sun Oct 5 16:30:43 EDT 2014


On Fri, 26 Sep 2014 12:04:03 -0400 (EDT), R P Herrold <herrold at owlriver.com> wrote:

> [herrold at centos-6 bin]$ history | cut -c 21- ...

> On Thu, 25 Sep 2014, jep200404 at columbus.rr.com wrote:

> > The history can have timestamps. This can help one look for
> > an old command that
> 
> ... that 'cut' command is to trim away time and date (which is 
> fixed column width) marking from my archive (mentioned in a 
> moment)

For long (>=10**5) histories, the line number gets wider.
Does sed in the following example suffice?
What is a better regular expression?

history | sed -e 's/^ *[0-9][0-9]*  [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] //gi' | sort | uniq -c | sort -nr | head


More information about the colug-432 mailing list