Delete the last word of your line
as you aim the string key3 value3
sed -i '/key3 value3/s/\S*$//' test.db
where \ S is a number that is not a space or a space.
Deleting the last word of a specific line (general rule)
sed -i '/line pattern/s/\S*$//' test.db
a line pattern is a pattern that is in the line that you want to target
source share