shell 读取yaml 之 shyaml
安装shyaml
pip3. install shyaml
file.yaml文件内容
---
idc_group:
name: bx
bx:
news_bx: news_bx
web3_bx: web3_php-fpm_bx
task: [1,2,3,4,5,6]
(testenv3.) localhost:testenv3. macname$ cat file.yaml | shyaml get-value idc_group.name
bx
(testenv3.) localhost:testenv3. macname$
(testenv3.) localhost:testenv3. macname$ cat file.yaml | shyaml key-values idc_group.bx
news_bx
news_bx
web3_bx
web3_php-fpm_bx
(testenv3.) localhost:testenv3. macname$
例子
get-value:获取值
(testenv3.) localhost:testenv3. macname$ cat file.yaml | shyaml get-value idc_group.bx.news_bx
news_bx
(testenv3.) localhost:testenv3. macname$ get-type:获取相应的类型
(testenv3.) localhost:testenv3. macname$ cat file.yaml | shyaml get-type idc_group.bx.news_bx
str
(testenv3.) localhost:testenv3. macname$ get-values{,-}:对序列类型来说,获取值列表
(testenv3.) localhost:testenv3. macname$ cat file.yaml | shyaml get-values idc_group.bx.task (testenv3.) localhost:testenv3. macname$ keys{,-}:返回键列表
(testenv3.) localhost:testenv3. macname$ cat file.yaml | shyaml keys idc_group
name
bx
(testenv3.) localhost:testenv3. macname$ cat file.yaml | shyaml keys idc_group.bx
news_bx
web3_bx
task
(testenv3.) localhost:testenv3. macname$ values{,-}:返回值列表
(testenv3.) localhost:testenv3. macname$ cat file.yaml | shyaml values idc_group.bx
news_bx
web3_php-fpm_bx
-
-
-
-
-
-
(testenv3.) localhost:testenv3. macname$ cat file.yaml | shyaml values idc_group
bx
news_bx: news_bx
web3_bx: web3_php-fpm_bx
task:
-
-
-
-
-
-
(testenv3.) localhost:testenv3. macname$ key-values,{,-}:返回键值对
(testenv3.) localhost:testenv3. macname$ cat file.yaml | shyaml key-values idc_group.bx
news_bx
news_bx
web3_bx
web3_php-fpm_bx
task
-
-
-
-
-
-
(testenv3.) localhost:testenv3. macname$ cat file.yaml | shyaml key-values idc_group
name
bx
bx
news_bx: news_bx
web3_bx: web3_php-fpm_bx
task:
-
-
-
-
-
-
(testenv3.) localhost:testenv3. macname$
参考:
https://www.linuxidc.com/Linux/2016-04/130403.htm
shell 读取yaml 之 shyaml的更多相关文章
- Python读取Yaml文件
近期看到好多使用Yaml文件做为配置文件或者数据文件的工程,随即也研究了下,发现Yaml有几个优点:可读性好.和脚本语言的交互性好(确实非常好).使用实现语言的数据类型.有一个一致的数据模型.易于实现 ...
- Shell读取配置文件的方法
参考:http://www.cnblogs.com/binbinjx/p/5680214.html 做批量软件安装自动化时,都喜欢用配置文件的方式改变参数,那怎么通过shell读取配置文件的配置呢?参 ...
- python的logging模块之读取yaml配置文件。
python的logging模块是用来记录应用程序的日志的.关于logging模块的介绍,我这里不赘述,请参见其他资料.这里主要讲讲如何来读取yaml配置文件进行定制化的日志输出. python要读取 ...
- shell读取文件内容并进行变量赋值
需求: shell读取文件内容,然后把内容赋值给变量然后进行字符串处理 实现: dataline=$(cat /root/data/data.txt) echo $dataline
- Golang 入门系列(九) 如何读取YAML,JSON,INI等配置文件
实际项目中,读取相关的系统配置文件是很常见的事情.今天就来说一说,Golang 是如何读取YAML,JSON,INI等配置文件的. 1. json使用 JSON 应该比较熟悉,它是一种轻量级的数据交换 ...
- 使用python读取yaml文件
在做APP测试时,通常需要把参数存到一个字典变量中,这时可以将参数写入yaml文件中,再读取出来. 新建yaml文件(android_caps.yaml),文件内容为: platformName: A ...
- shell读取文件的每一行内容并输出【转】
写法一: #!/bin/bash while read line do echo $line done < file(待读取的文件) 写法二: #!/bin/bash cat file(待读取的 ...
- 登录shell与非登录shell读取文件过程
登录shell与非登录shell读取文件过程登录:/etc/profile→/etc/profile.d/*.sh ~/.bash_profile非登录:~/.bash_profile→ ...
- java 读取 yaml 文件
做 java 项目用的最多的配置文件就是 properites 或者 xml, xml 确实是被用烂了,Struts, Spring, Hibernate(ssh) 无一不用到 xml.相比厚 ...
随机推荐
- 单个视频播放控制&默认横屏播放
一.视频列表中控制只允许一个视频播放 // 获取DOM中所有的video标签 var videoTags = document.querySelectorAll('video'); // 控制播放的视 ...
- poj-3404 Bridge over a rough river Ad Hoc
Bridge over a rough river POJ - 3404 Bridge over a rough river Time Limit: 1000MS Memory Limit: 65 ...
- idea中的后缀补全
IDEA有个很牛逼的功能,那就是后缀补全(Postfix Completion),这个功能可以通过后缀来使用代码补全进行模板式地补全语句,如遍历循环语句(for.foreach).使用 String. ...
- Kubernetes PV与PVC的关系
Kubernetes PV与PVC的关系 PersistenVolume(PV):对存储资源创建和使用的抽象,使得存储作为集群中的资源管理,分为有静态与动态.PersistentVolumeClaim ...
- Spring集成Quartz框架的两种方式。
可参考:https://blog.csdn.net/yk614294861/article/details/84324603 1.使用Spring与Quarta配置作业得两种方式: a.方式一,Met ...
- linq,创建数据库,插入数据,newDB.CreateDatabase();newDB.tb2.InsertOnSubmit(stu); newDB.SubmitChanges();
using System.Data.Linq;using System.Data.Linq.Mapping; namespace ConsoleApplication1388{ class Progr ...
- EF操作与Linq写法记录
项目总结:EF操作与Linq写法记录 1.EF引入 新建一个MVC项目之后,要引用EF框架,可以按照以下步骤进行: 1),在Models中添加项目 2),选择Entity Data Model,并重新 ...
- shell脚本实现自动化安装linux版本的loadrunner agent(centos6.8)
#!/bin/bash #Centos6下安装LoadRunner负载机 #@author Agoly #@date #@source 高级测试技术交流圈: yum -y install expect ...
- 【转】Git使用教程之远程仓库
1.远程仓库 在了解之前,先注册github账号,由于你的本地Git仓库和github仓库之间的传输是通过SSH加密的,所以需要一点设置: 第一步:创建SSH Key.在用户主目录下,看看有没有.ss ...
- oracle查询中会使索引无效的情况总结
总结一下oracle中会使索引无效的情况 1 无where条件: 2 索引列进行运算时: 3 使用like,并且通配符在前的情况: 4 字符型字段为数字时在where条件里不添加引号: 5 not i ...