linux - 编辑多个 RHEL fstab 文件

标签 linux unix sed

我必须编辑多个/etc/fstab 文件...大约 28 个服务器 当前行需要是

/dev/vdb/mnt 自动默认值,nobootwait,comment=cloudconfig 0 2

必须是

/dev/vdb/mnt ext4 默认 1 1

我如何使用 sed 或任何其他建议来做到这一点?

谢谢

最佳答案

使用命令 -

查找/etc/fstab -print|xargs sed -i '15s/0/1/;14s/2/1/;s/auto/ext4/;s/defaults,nobootwait,comment=cloudconfig/default/' 替换所需字段 并通过fabric推送到服务器

谢谢

关于linux - 编辑多个 RHEL fstab 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38257546/

相关文章:

c++ - 将标准输出重定向到系统日志

sed 在数字指定的行后插入文件内容

linux - 在以下两个选项卡的每次出现之间插入特定文本

python - 用 fabric 读取日志

linux - 将本地仓库推送到远程不会使用 GIT 推送子模块文件

c - 在Unix/Linux shell编程:the difference between > and >&

bash - Unix 找到 : multiple -o and exec not working together

linux - 如何使用命令获取替换该文件的文件的备份

linux - bash lsof : get pid from one tty to another one

python - 如何检查属于可变大小行 block 的多行的多个条件并返回主行