linux - 替换文件夹和子文件夹中的字符串 - Linux

标签 linux shell

我要替换

/oracle/apps/xxsnc/ab 到/xxsnc/oracle/apps/ab

我试过了

find . -type f exec sed -i 's//oracle/apps/po//xxsnc/oracle/apps/ab/g' {} \;

它的抛出错误如 sed: e expression #1, char unknown to s

请帮忙

最佳答案

find ./ -type f -exec sed -i -e 's/\/oracle\/apps\/xxsnc\/ab/\/xxsnc\/oracle\/apps\/ab/gc' {} \;

使用 \(转义字符)。

sed 中的可选 c 标志会在每次更改前提示。

关于linux - 替换文件夹和子文件夹中的字符串 - Linux,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42898324/

相关文章:

c - pthread_mutex_lock 需要很多时间

linux - 在Linux脚本中,如何删除当前目录中除一个之外的所有文件和目录?

具有多个命令和可重入的 BASH 变量

bash - 如何将存储在变量上的参数传递给 WGET

python - 首选项窗口在关闭时销毁 - Glade、Gtk、Python

python - 我如何自动化我用 python 编写的爬虫程序每月运行一次?

linux - Fedora 14 上的 Amazon AWS s3fs 挂载问题

linux - 如何按名称查询加载的模块?

linux - Tmux 在调用 `shell` 显示 Bash 命令的输出时不显示换行符

linux - shell 脚本中的 usage() 是什么?