使用命令行更改所有内容

发布于 2024-09-09 03:17:29 字数 86 浏览 1 评论 0原文

我想知道是否有一种方法可以使用命令行更改 /www/ 目录中所有文件中的特定单词。只是寻找一种更快的方法来更改特定单词,这样我就不需要手动打开所有文件!谢谢!

I'm wondering if there is a way to change a specific word in all of the files within the /www/ directory using command line. Just looking for a faster way to change out a specific word so I don't need to open all the files manually! Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蘸点软妹酱 2024-09-16 03:17:29

find /www -type f -exec sed -i 's/foo/bar/g' \{\} \;

每次 foo 出现在 中的任何文件中时,此行都会将 foo 替换为 bar >/www。在运行之前,请务必确保您知道 /www 下有什么以及替换后会对这些文件执行什么操作。

find /www -type f -exec sed -i 's/foo/bar/g' \{\} \;

This line will replace foo with bar every time foo occurs in any file in /www. Be very sure you know what's under /www and what the replacement would do to those files before running it.

栖迟 2024-09-16 03:17:29

您可能正在寻找 grep-sed 解决方案来查找并替换,如果您使用的是 Mac(并指 Mac 的终端应用程序)。

You might be looking for a grep-sed solution to find and replace, if you are on a Mac (and referring to the Mac's Terminal app).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文