====== Pour remplacer des trucs de Wiki.js ====== sed -i.bak2 's//====== \1 ======/g' cube.txt sed -i.bak2 's//===== \1 =====/g' cube.txt Suite à la conversation : hello how to search for , sorry. So that's a bit complicated in sed, let me think. if another tool is necessary, what would you recommand ? Since your data is XML I'd recommend something that understands XML. Perhaps xmlstarlet or xmllint. ok.. it helps me for the moment, and if it's not enough, I'll have a look on xmlstartel or xmlint. thanks for your help well hm, since you are not looking for a robust solution anyway, perhaps this would suffice for your current situation: # echo '====== some title ======' | sed 's//====== \1 ======/g' Riviera: ====== some title ====== sed 's//====== \1 ======/g'