当前位置:网站首页>Crudini 配置文件编辑工具
Crudini 配置文件编辑工具
2022-07-07 01:25:00 【华为云】
Crudini 是 Pádraig Brady 用 Python 开发的、用来对ini配置文件进行编辑的工具。
crud是4个单词的首字母简写,即create、read、update和delete,中文译为“增删改查”。这个是数据的最常见的4类操作方法。
安装
# centosyum install -y crudini语法格式
crudini --set [OPTION]... config_file section [param] [value] crudini --get [OPTION]... config_file [section] [param] crudini --del [OPTION]... config_file section [param] [list value] crudini --merge [OPTION]... config_file [section]常用参数:
| --get | 获取配置文件中的节或键值 |
| --set | 设置键值 |
| --merge | 合并配置文件 |
| --format=FMT | 为--get 使用,选择输出格式。格式有sh,ini,lines |
| --inplace | 锁定并写入文件, 比默认的替换有更少的限制 |
| --list | 为--set和--del,更新一个列表(集合)的值 |
| --list-sep=STR | 使用自定义的字符代替默认的逗号 |
| --output=FILE | 将输出写入文件。’-“表示标准输出” |
| --verbose | 在错误输出上指出是否进行了更改 |
示例
获取一个键值
# 获取 nova.conf配置文件 TEST节 abc键的值crudini --get nova.conf TEST abc获取一个不在节里面的值
crudini --get nova.conf '' abc获取一个节的键
crudini --get nova.conf DEFAULT添加或更新一个不在节里面的值
crudini --get nova.conf '' abc 456添加或更新一个键值
# 设置 cinder.conf文件 DEFAULT节 auth_strategy键的值为keystonecrudini --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone更新一个已存在的键值(如果变量不存在会返回“Parameter not found:”):
crudini --set --existing /etc/cinder/cinder.conf DEFAULT auth_strategy keystone删除一个键
# 删除 nova.conf配置文件 DEFAULT节 abc键crudini --del nova.conf DEFAULT abc删除一个节
# 删除nova.conf配置文件 TEST节crudini --del nova.conf TEST合并配置文件
# 将test1.ini合并到test.inicrudini --merge test.ini < test1.ini# 输出可由shell解析的节 eval $(crudini --get --format=sh config_file section)# 从shell变量更新ini文件 echo name="$name" | crudini --merge config_file section# 使用标准UNIX文本处理比较两个ini文件 diff <(crudini --get --format=lines file1.ini|sort) \ <(crudini --get --format=lines file2.ini|sort)边栏推荐
- Jmeter自带函数不够用?不如自己动手开发一个
- Jstack of JVM command: print thread snapshots in JVM
- Reading notes of Clickhouse principle analysis and Application Practice (6)
- C note 13
- 线性回归
- 职场经历反馈给初入职场的程序员
- JVM命令之- jmap:导出内存映像文件&内存使用情况
- Opensergo is about to release v1alpha1, which will enrich the service governance capabilities of the full link heterogeneous architecture
- POI excel export, one of my template methods
- 从“跑分神器”到数据平台,鲁大师开启演进之路
猜你喜欢

目标检测中的BBox 回归损失函数-L2,smooth L1,IoU,GIoU,DIoU,CIoU,Focal-EIoU,Alpha-IoU,SIoU

From "running distractor" to data platform, Master Lu started the road of evolution

JVM monitoring and diagnostic tools - command line
![[FPGA tutorial case 13] design and implementation of CIC filter based on vivado core](/img/19/1a6d43c39f2cf810ba754ea9674426.png)
[FPGA tutorial case 13] design and implementation of CIC filter based on vivado core

Detailed explanation of platform device driver architecture in driver development

JVM命令之 jstat:查看JVM統計信息

Jinfo of JVM command: view and modify JVM configuration parameters in real time

Go语学习笔记 - gorm使用 - gorm处理错误 | Web框架Gin(十)

职场经历反馈给初入职场的程序员

【FPGA教程案例14】基于vivado核的FIR滤波器设计与实现
随机推荐
Say sqlyog deceived me!
STM32 key state machine 2 - state simplification and long press function addition
Jcmd of JVM command: multifunctional command line
How to improve website weight
职场经历反馈给初入职场的程序员
Jstack of JVM command: print thread snapshots in JVM
Redisl garbled code and expiration time configuration
On the difference between FPGA and ASIC
Cloud acceleration helps you effectively solve attack problems!
Web authentication API compatible version information
[FPGA tutorial case 14] design and implementation of FIR filter based on vivado core
The solution of a simple algebraic problem
JVM命令之- jmap:导出内存映像文件&内存使用情况
目标检测中的损失函数与正负样本分配:RetinaNet与Focal loss
【SQL实战】一条SQL统计全国各地疫情分布情况
软件测试知识储备:关于「登录安全」的基础知识,你了解多少?
Chain storage of stack
C note 13
Storage of dental stem cells (to be continued)
PowerPivot——DAX(函数)