You can remove a command from history as follows:
$history -d <offset>
For example,
$ history
1 cd /home
2 rm filename
3 ls -l
4 touch new
5 cp new new1
6 history
$ history -d 4
4 cp new new1
5 history
6 history -d 4
7 history
Also , if you want to execute a command from history it can be executed as
$ !<offset>
for example,
$ !3
will execute "ls -l"