Example, kill a process which is running systemctl start docker.service

sudo kill -9 $(ps aux | grep "systemctl start docker.service" | head -n 1 | awk '{print $2}')

Note the use of grep here.