I need to replace a word after multiple spaces :
actually the file contains this string :
local all all
Try this (using GNU sed-Version 4.2.1):
GNU sed-Version 4.2.1
sed -E -i.bak 's/(all\s+)peer/\1md5/' file