Almost 10 years ago, I asked this question
and got this useful command find . -type f -print0 | xargs -0 sed -i 's/regex_search_term/replace_term/g'
I decided to learn more about the find
, xargs
and sed
statement. On Ubuntu 18.04 in bash version 4.4.20(1)-release, I can simplify the statement to this:
find . -type f -print | xargs sed -i 's/regex_search_term/replace_term/g'
Which can then be simplified again to this:
find . -type f | xargs sed -i 's/regex_search_term/replace_term/g'
So my question is, are there any drawbacks to not using the -print0
flag with the -0
flag of find
and xargs
respectively? And are there any drawbacks to dropping the -print
flag altogether? Are they explicitly used for compatibility with different unix like systems?