我有下面的代码块:如何使用awk/sed在两行之间添加一行新文本? (在文件中)
{
"operation_machine": "Ford",
"operation_steps": [
"steps/Step_1/01_paint_the_car.json",
"steps/Step_2/01_drive_the_car.json",
"steps/Step_2/02_park_the_car.json"
]
}
我想在线x和y之间的列表中添加一个新行(步骤)。我说,如果我需要增加行动数字“2”(字符串= wax_the_car)步骤用于“1”会看看到底这样的:
{
"operation_machine": "Ford",
"operation_steps": [
"steps/Step_1/01_paint_the_car.json",
"steps/Step_1/02_wax_the_car.json",
"steps/Step_2/01_drive_the_car.json",
"steps/Step_2/02_park_the_car.json"
]
}
我刚坐进AWK,但我想我需要在我可以自己做这件事之前10次阅读这本书。 我需要你的帮助男生/女生。
为什么要使用文本处理工具来编辑JSON?为什么不使用JSON处理工具呢? –
因为这是我必须去做的环境。 :) –