且构网

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

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

更新时间:2023-02-18 10:32:55

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

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.