【问题标题】:sed -i scripting a json filesed -i 编写一个 json 文件的脚本
【发布时间】:2018-03-04 01:17:09
【问题描述】:

我正在尝试使用 sed 脚本将 { "index" : {} }\n 添加到 json 文件中。

sed -e 's/^/{ "index" : {} }\n/' -i 
/Users/p2s/Desktop/untitled_folder/sku.json 

但是我得到一个错误

sed: -i may not be used with stdin

谁能告诉我错误是什么以及如何解决?

【问题讨论】:

  • 不要使用 sed 等解析 json。发布您的sku.json 内容
  • sed -i '...' file 阅读手册页,在哪里放置选项。

标签: json shell sed


【解决方案1】:
sed -i -e 's/^/{ "index" : {} }\n/' /Users/p2s/Desktop/untitled_folder/sku.json 

应该做的工作

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-08-11
    • 2021-07-25
    • 2012-08-26
    • 2013-09-01
    • 2018-06-09
    • 2011-01-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多