I am using following command in Mac to replace string. Here I have a question about -print0. What's usage of it?
find skeleton/src/IO.Swagger/Controllers -name '*.cs' -print0| xargs -0 sed -i "" "s/namespace IO.Swagger.Controllers/namespace Abc.GroupA.TableLocalService.Controllers/g"
With -print0, find will separate the filenames with a null character (a zero byte). xargs must then be called with -0 (or --null, I recommend using long options in scripts, which increase readability, and reserve shortenings for disposable commands in an interactive console).
This way, you can use spaces or whatever characters, including new-lines, in the filenames.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With