linux原生支持的格式化文件方法

利用python格式json

python -m json.tool

echo '{"list":[{"a":"1"},{"b":"2"}]}' |python -m json.tool
cat x.json
{"list":[{"a":"1"},{"b":"2"}]}

python -m json.tool  x.json
{
    "list": [
        {
            "a": "1"
        },
        {
            "b": "2"
        }
    ]
}

利用python计算

python -c ‘print(123+456+7.89)’

xmllint格式化xml文件

xmllint –format pom.xml

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.