Arquivo Bash Cat e reescreva a mesma linha

sed -e ... "datafile" >"datafile.tmp" && mv -f "datafile.tmp" "datafile"
Shy Stag