美文网首页
记录字符串转header

记录字符串转header

作者: 夜空最亮的9星 | 来源:发表于2021-04-08 18:22 被阅读0次

    字符串如下:
    mac_address=08%3A00%3AX7%3E5A%3AGB%3AE0&language=zh&device_brand=Android&type=readmore&uuid=11230&device_id=1900232321&smix=a&before_timestamp=01&show_moment=20&os_version=6.0.1&channel=xiaomi

    t1.sh 文件内容如下:

    input_str=$1
    
    echo $input_str | sed 's/&/\n/g' | awk -F "=" '{print "'\''" $1 "'\''" ":" "'\''" $2 "'\''"  "," }'
    
    

    执行 : sh t1.sh 'mac_address=08%3A00%3AX7%3E5A%3AGB%3AE0&language=zh&device_brand=Android&type=readmore&uuid=11230&device_id=1900232321&smix=a&before_timestamp=01&show_moment=20&os_version=6.0.1&channel=xiaomi'

    'mac_address':'08%3A00%3AX7%3E5A%3AGB%3AE0',
    'language':'zh',
    'device_brand':'Android',
    'type':'readmore',
    'uuid':'11230',
    'device_id':'1900232321',
    'smix':'a',
    'before_timestamp':'01',
    'show_moment':'20',
    'os_version':'6.0.1',
    'channel':'xiaomi',
    

    相关文章

      网友评论

          本文标题:记录字符串转header

          本文链接:https://www.haomeiwen.com/subject/pumvkltx.html