I’m new to shell scripting but getting this error and cant figure out what up.
sed: 1: "/Users/local/Do ...": extra characters at the end of d command
sed: 1: "/Users/local/Do ...": extra characters at the end of d command
sed: 1: "/Users/local/Do ...": extra characters at the end of d command
sed: 1: "/Users/local/Do ...": extra characters at the end of d command
Here is the script I’m running
for fl in $(S_convertPath ${RESOURCE_DIR}/db)/db.changelog-*xml; do
sed -i "s/HOSTNAME/${IP_ADDRESS}/g" $fl
done
Thanks
Given that
sedseems to think you’re running adelete linecommand (d), you may want to output the command to see what’s actually in that environment variable of yours:There’s a good chance the
PSM_SERVER_ADDRESSis corrupting yoursedcommand (and may need to be processed to make it clean). One way to do this (provided you have a recent enoughsed) would be to use delimiters that do not appear in the environment variable, for example:Since you’ve accepted this answer, I may as well add the resolution for the additional problem you found. It appears that BSD
sed, unlike Linux, has a requirement that you provide an extension to the-ioption. So, while Linux allows:to edit in-place, the BSD variant needs to have:
with an empty backup suffix.
Without that,
sedmay use your command as the extension and your first file name as the command.