当前位置:网站首页>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)
边栏推荐
- Say sqlyog deceived me!
- Career experience feedback to novice programmers
- 老板总问我进展,是不信任我吗?(你觉得呢)
- 关于STC单片机“假死”状态的判别
- Ctfshow-- common posture
- Bbox regression loss function in target detection -l2, smooth L1, IOU, giou, Diou, ciou, focal eiou, alpha IOU, Siou
- PTA TIANTI game exercise set l2-003 moon cake test point 2, test point 3 Analysis
- Input of native applet switches between text and password types
- Experience of Niuke SQL
- PTA ladder game exercise set l2-002 linked list de duplication
猜你喜欢
目标检测中的BBox 回归损失函数-L2,smooth L1,IoU,GIoU,DIoU,CIoU,Focal-EIoU,Alpha-IoU,SIoU
Dc-7 target
Jstat of JVM command: View JVM statistics
可极大提升编程思想与能力的书有哪些?
Why does the data center need a set of infrastructure visual management system
mac版php装xdebug环境(m1版)
Forkjoin is the most comprehensive and detailed explanation (from principle design to use diagram)
@pathvariable 和 @Requestparam的详细区别
Nvisual network visualization
Question 102: sequence traversal of binary tree
随机推荐
Mac version PHP installed Xdebug environment (M1 version)
SubGHz, LoRaWAN, NB-IoT, 物联网
Detailed explanation of platform device driver architecture in driver development
The boss always asks me about my progress. Don't you trust me? (what do you think)
jmeter 函数助手 — — 随机值、随机字符串、 固定值随机提取
目标检测中的损失函数与正负样本分配:RetinaNet与Focal loss
苹果cms V10模板/MXone Pro自适应影视电影网站模板
What EDA companies are there in China?
How much do you know about clothing ERP?
The solution of a simple algebraic problem
Why does the data center need a set of infrastructure visual management system
What is make makefile cmake qmake and what is the difference?
ML's shap: Based on the adult census income binary prediction data set (whether the predicted annual income exceeds 50K), use the shap decision diagram combined with the lightgbm model to realize the
Question 102: sequence traversal of binary tree
C. colonne Swapping [tri + Simulation]
老板总问我进展,是不信任我吗?(你觉得呢)
POI excel export, one of my template methods
SAP ABAP BDC (batch data communication) -018
k8s运行oracle
外设驱动库开发笔记43:GPIO模拟SPI驱动