Text substitution (reading from file and saving to the same file) on linux with sed

On Linux, sed -i is the way to go. sed isn’t actually designed for in-place editing, though; historically, it’s a filter, a program which edits a stream of data in a pipeline, and for this usage you would need to write to a temporary file and then rename it.

The reason you get an empty file is that the shell opens (and truncates) the file before running the command.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)