1

How to delete commands in history matching a given string?

view story
linux-howto

http://unix.stackexchange.com – I need to delete all commands in my history matching a string. I've tried: $ history | grep searchstring | cut -d" " -f2 | history -d -bash: history: -d: option requires an argument $ history | grep searchstring | cut -d" " -f2 | xargs history -d xargs: history: No such file or directory $ temparg() { while read i; do "$@" "$i"; done } $ history | grep searchstring | cut -d" " -f2 | temparg history -d (no error, but nothing is deleted) What is the right way to do this? (HowTos)