To replace all occurrences of "foo" with "bar" in a file using sed, what would be the correct command?
sed 's/foo/bar/' file.txt
sed 's/foo/bar/g' file.txt
sed 'r/foo/bar/g' file.txt
sed 'r/foo/bar/' file.txt