sed command creating unwanted duplicates of file with -e extension

On OSX sed (BSD) sed requires an extension after -i option. Since it is finding -e afterwards it is adding -e to each input filename. btw you don’t even need -e option here.

You can pass an empty extension like this:

sed -i '' 's/foo/bar/g' $file

Or use .bak for an extension to save original file:

sed -i.bak 's/foo/bar/g' $file

Leave a Comment

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