3 ms·
It is unclear what this tries to achieve. Could you please explain why this removes the need for temporary files?
by kovek 10y ago
It is unclear what this tries to achieve. Could you please explain why this removes the need for temporary files?
- deleted 10y ago[deleted]
- Annatar 10y agoIf you want to perform an in-place edit, and you want to do it in a portable manner (not using GNU sed -i), you'd have to use sed with at least one temporary file: % sed -e 's/something/other/' somefile > /tmp/temp.$$ && mv /tmp/temp.$$ somefile now, using ed (or AWK) and the heredoc with ed commands above, you can mmap(2) the entire file into memory, perform desired editting, and write it all out in one go. No more temporary files!
- falcolas 10y agoSed, when operating on a file, creates a temporary file alongside the target file.