I am trying to delete a specific entry in history. Clarification--by that I mean deleting all occurences containing a given command/or text. I used Aliteralmind's hxf script: :<Examples    hxf rm -rf#The unalias prevents odd errors when calling. ~/.bashrc (May result in#not found errors. That's okay).unalias hxfhxf()  {read -r -p About to delete all items from history that match \$1\.      Are you sure? [y/N]  responseresponse=${response,,}    # tolowerif [[ $response =~ ^(yes|y)$ ]]then    #Delete all matched items from the file, and duplicate it to a temp    #location.    echo -e grep -v \$1\ \$HISTFILE\ > /tmp/history    grep -v $1 $HISTFILE > /tmp/history    #Clear all items in the current sessions history (in memory). This    #empties out $HISTFILE.    echo history -c    history -c    #Overwrite the actual history file with the temp one.    echo -e mv /tmp/history \$HISTFILE\    mv /tmp/history $HISTFILE    #Now reload it.    echo -e history -r \$HISTFILE\    history -r $HISTFILE     #Alternative: exec bashelse    echo Cancelled.fi}(from https://unix.stackexchange.com/a/178956/115826)However after running the hxf script, history gives me: (for example)401 254: 263: 287: 288: 293: cd ~402 203: 243: 290: 309: 315: 332: 370: 377: 389: 400: ls403 200: 207: 255: 263: 302: 325: 359: 378: 385: 393: 397: 399: neditHow to modify the hxf() script to eliminate history displaying a list of indices for each occurrence of a command? After running hxf() I get the above. Prior to running it, history gives:401 cd ~402 ls403 neditThe list of entries gets quite long and unreadable quickly. I need for    history output to appear as it did prior to running hxf with the only difference being the command(s) I deleted with hxf() now removed.
deleting all occurences of a given command from history
history