如何在-exec参数中使用重定向

Clear log file content without impacting service that is running (in batch):

find . -name "*.log" -exec bash -c ">{}" \;

Subsitute file content in batch:

find -name "*.xml" -exec bash -c "sed -e 's/aaa/bbb/' {} > {}" \;

猜你喜欢

转载自huanyue.iteye.com/blog/1889443