I am trying to find out if it is possible to edit a file in a single sed command without manually streaming the edited content into a new file and
mv file.txt file.tmp && sed 's/foo/bar/g' < file.tmp > file.txt
Should preserve all hardlinks, since output is directed back to overwrite the contents of the original file, and avoids any need for a special version of sed.