Re: bash history customizing
From: Thorsten Kampe (thorsten_at_thorstenkampe.de)
Date: 05/28/04
- Next message: Ed Morton: "Re: bash history customizing"
- Previous message: Stephane CHAZELAS: "Re: bash history customizing"
- In reply to: Gabkin: "Re: bash history customizing"
- Next in thread: Ed Morton: "Re: bash history customizing"
- Reply: Ed Morton: "Re: bash history customizing"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 28 May 2004 15:25:21 +0200
* Gabkin (2004-05-28 14:12 +0100)
> On Fri, 28 May 2004 11:22:16 +0200, Thorsten Kampe
> <thorsten@thorstenkampe.de> wrote:
>
>>* Gabkin (2004-05-28 08:55 +0100)
>>> I also want to eliminate all duplicate commands in my history file,
>>> but I want to keep the most recent duplicate only.
>>> In other words if my history contains this...
>>>
>>> 1 cd $HOME
>>> 2 vi somefile.txt
>>> 3 cp somefile anotherfile
>>> 4 exit
>>> 5 cd $HOME
>>> 6 vi somefile
>>> 7 exit
>>>
>>> I would like it to become
>>>
>>> 1 cp somefile anotherfile
>>> 2 cd $HOME
>>> 3 vi somefile
>>> 4 exit
>>>
>>> This way, over time most of my useful, regularly used commands would
>>> rise to the top, while the useless ones would sift to the bottom of
>>> the list. (for eventual manual purging?)
>>>
>>> The obvious way is via a sort -u, but this sorts alphabetically which
>>> is totally not what I want.
>
>>uniq or zsh
>
> uniq cant do anything that a sort -u cant do,
Think again: uniq has the ability /not to sort/ and "sort" hasn't got
this ability.
> unless there is some kind of uniq option to get rid of duplicates
> but keep the _last_ duplicate, not the first.
tac | uniq | tac
> Also, I dont want to sort the history alphabetically, Im trying to
> sort it by common usage.
>
> As for zsh, I'm a bash man!
So what? If you want basic functionality you use a basic tool suited
for that (bash). If you want extended functionality you use a tool
appropriate for that (zsh)
Thorsten
- Next message: Ed Morton: "Re: bash history customizing"
- Previous message: Stephane CHAZELAS: "Re: bash history customizing"
- In reply to: Gabkin: "Re: bash history customizing"
- Next in thread: Ed Morton: "Re: bash history customizing"
- Reply: Ed Morton: "Re: bash history customizing"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|