I am using sed to search and replace two strings in a file in bash (GNU sed)
This is the file after
-rw-r--r-- 1 websync www-data 4156 mar 27 12:56 /
The redirection opens the file for output, truncating it. This happens simultaneously to sed
opening it for reading, so sed
sees the truncated version. You should redirect your output to a different file to avoid clobbering your input, or use sed
's in-place editing mode instead of using redirection:
sed 's/www-test/www/g' -i /home/websync/tmp/sitio-oficial/sitios/wp-config.php