Re: history command

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Craig White
Date:  
To: plug-discuss
Subject: Re: history command
On Fri, 2004-12-31 at 13:27 -0700, Chris Gehlker wrote:
> On Dec 31, 2004, at 12:01 PM, Craig White wrote:
>
> > I would love to list the steps that I took from history without the
> > line
> > numbers...
> >
> > i.e.
> > history > /root/install.log
> >
> > puts line numbers in the file. How to simply get the commands?
>
>
> History is a shell built-in so it will depend on what you are running.
> -h works some places. In bash it is more common to use fc to mess about
> with the history file. The -n option to fc does what you want.

----
fc -n -l -[x] sort of worked but it left the space where the numbering
was at which would have necessitated another step.

Simon's cut command was perfect...

> quick and dirty and certainly a better way but,
>
> use cut
>
> history |cut -f4,5,6,7,8,9 -d" " >/tmp/outfile


I wish that I could coalesce the cut command into my brain but when
usage seems valuable about once a year, it doesn't retain in my damaged
brain.

Thanks for the tip on fc - there is a ton about bash that I don't know.

Craig

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss