且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何更改目录中所有文件中出现的所有单词

更新时间:2023-02-18 10:20:47

考虑到子目录的变体(未经测试):

A variation that takes into account subdirectories (untested):

find /var/www -type f -exec sed -i 's/privelages/privileges/g' {} ;

这将find /var/www 下的所有文件(不是目录,由-type f 指定),并执行sed 命令在它找到的每个文件上用特权"替换特权".

This will find all files (not directories, specified by -type f) under /var/www, and perform a sed command to replace "privelages" with "privileges" on each file it finds.