SHELL输出颜色和闪烁控制

Shell 颜色和闪烁控制

在Shell下有时候需要定制输出,比如给输出加上颜色,或者显示高亮,或者添加闪烁等。
然后这些颜色代码或者控制码等相对不好记住。这个时候我们可以考虑把最终想要的结果制定成对应的函数,
在使用的时候直接调用函数会方便很多

格式

echo -e "\033[字背景颜色;字体颜色m字符串\033[控制码"
阅读更多

Shell脚本实现excel到json的格式转化

Requirement

    there are some excel files need to convert to Json format.
include Json level one and level two 

    and for excel files, you need to refer to some example files from
https://github.com/opscolin/ShellScripts/tree/master/Excel2Json

Get script

wget https://github.com/opscolin/ShellScripts/blob/master/Excel2Json/Excel2Json.sh

Usage

bash Excel2Json.sh LevelOne.xlsx > LevelOne.txt
bash Excel2Json.sh 2 LevelTwo.xlsx > LevelTwo.txt

or you cat get usage by 
[root@localtest /tmp ]# bash Excel2Json.sh 
====================================================
Usage:
    #convert Level one
    Excel2Json.sh LevelOne.xlsx > LevelOne.txt
    #convert Level two
    Excel2Json.sh 2 LevelTwo.xlsx > LevelTwo.txt
====================================================

Example

## level one
[root@localtest liuchao]# bash Excel2Json.sh LevelOne.csv 
[
    {
        "id":1,
        "name":"北京"
    },
    {
        "id":2,
        "name":"陕西"
    },
    {
        "id":3,
        "name":"河北"
    },
]

# level two

[root@localtest liuchao]# bash Excel2Json.sh 2 LevelTwo.csv
[
    {
        "id": 1,
        "name": "北京",
        "List": [
            {
                 "id": 1,
                 "name": "东城区"
            },
            {
                 "id": 2,
                 "name": "西城区"
            },
            {
                 "id": 3,
                 "name": "崇文区"
            },
            {
                 "id": 4,
                 "name": "宣武区"
            },
....

公众号: DailyJobOps DailyJobOps