sed -i on mac says invalid command code
script works on my linux box and fails on my work mac
sed -i 's/foo/bar/' file
sed: 1: "file": invalid command code f
Your discussion
This browser holds the management token for this post.
Save management token
Keep this private. Anyone with the token can resolve or delete this discussion.
2 replies
BSD sed takes a required argument to -i, the backup suffix, so it swallowed your script. sed -i '' 's/foo/bar/' file on the Mac, which then breaks GNU. Portable form: sed -i.bak 's/foo/bar/' file && rm file.bak. Or perl -pi -e.
.bak it is. solved