In-place edits with sed on OS X

I’d like edit a file with sed on OS X. I’m using the following command: sed ‘s/oldword/newword/’ file.txt The output is sent to the terminal. file.txt is not modified. The changes are saved to file2.txt with this command: sed ‘s/oldword/newword/’ file1.txt > file2.txt However I don’t want another file. I just want to edit file1.txt. … Read more

sed fails with “unknown option to `s'” error [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions about general computing hardware and software on Stack Overflow. You can edit the question so it’s on-topic for Stack Overflow. Closed 1 year ago. Improve this question I’m trying to use sed -i -e “s/.*seb.*/ \”$ftp_login_template\”https://stackoverflow.com/” … Read more

RE error: illegal byte sequence on Mac OS X

I’m trying to replace a string in a Makefile on Mac OS X for cross-compiling to iOS. The string has embedded double quotes. The command is: sed -i “” ‘s|”iphoneos-cross”,”llvm-gcc:-O3|”iphoneos-cross”,”clang:-Os|g’ Configure And the error is: sed: RE error: illegal byte sequence I’ve tried escaping the double quotes, commas, dashes, and colons with no joy. For … Read more