Home > Back-end >  How to format the yaml file to a csv format?
How to format the yaml file to a csv format?

Time:10-31

I have used the yq command to format a yaml file:

cat includelist.yml |yq -r '.ProductLine.ADO_FeedsList'

output:

---
ProductLine:
  ProductLineName: AAAAA
  ADO_FeedsList:
  - ProjectName: IT
    FeedsName:
    - test
    - test2
  - ProjectName: organization
    FeedsName:
    - hello
    - world
---
ProductLine:
  ProductLineName: BBBBB
  ADO_FeedsList:
  - ProjectName: Fin
    FeedsName:
    - good
    - aaaa
  - ProjectName: organization
    FeedsName:
    - bbb
    - ccc

Could somebody give me some suggestion,I don't known how to convert to csv format.

My question: how to convert the content to the following format:

IT,test

IT,test2

orginazation,hello

orginazation,world

Fin,good

Fin,aaaa

organization,bbb

organization,ccc


Thanks a ton.

  • Related