Using bash, I save my history with the timestamp.
How do print the history omitting the timestamp?
alias h=history
alias g=grep -i
To find lines that I used for heroku, I type:
> h | g heroku
I'd like to unique the results without the time-stamp, naturally.
This question is somewhat related: How to avoid duplicate entries in .bash_history
However, sometimes I want to see the duplicate in the history to see the context under which a command was run.
Best Answer
Simply,
history | sed 's/.[ ]*.[0-9]*.[ ]*//' | uniq | grep -i "heroku"
the
sed
will remove the any [spaces][numbers][spaces] at the start of each linefor optimization make it
history | grep -i "heroku" | sed 's/.[ ]*.[0-9]*.[ ]*//' | uniq