[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

YAML: How to add additional lines after a specific line?



Hello community,

I have a YAML file for example `resource.yaml`.
I want to find in this file all the lines ( actually it should be only one ), with the following string: "resource_type: apple" and immediately after that line add the following lines:

```
  color: red
  weight: '1 kg'
  origin: "Country x"
```

The result should be:

```
resource_type:
  color: red
  weight: '1 kg'
  origin: "Country x"
```

Any advice using awk, sed or something else ?


Reply to: