sed -i '/^foo/! s/^/bar/' file.txt
-ichange the file in place/^foo/!only perform the next action on lines not!starting with foo^foos/^/bar/change the start of the line to bar
sed -i '/^foo/! s/^/bar/' file.txt
-i change the file in place/^foo/! only perform the next action on lines not ! starting with foo ^foos/^/bar/ change the start of the line to bar