This loop will display what I want to do but if I remove the echo
from it, it won't actually delete anything:
history | grep ":[0-5][0-9] ls *$" | cut -c1-5 |
while read id; do
echo history -d $id
done
I've added indentation in order to make it more readable but I am running it as a one-liner from the command line.
I have HISTTIMEFORMAT
set so the grep finds the seconds followed by ls
followed by an arbitrary number of spaces. Essentially, it's finding anything in history that's just an ls
.
This is using bash 4.3.11
on Ubuntu 14.04.3 LTS