i do have a JSON file as below:-
{
"Rules": [
{
"ID": "DMS-FULL-HISTORY-DATA-DEEPARCHIVE-1d",
"Filter": {
"Prefix": "HISTORY/DATA/"
},
"Status": "Enabled",
"Transitions": [
{
"Days": 1,
"StorageClass": "DEEP_ARCHIVE"
}
]
},
{
"ID": "FOL-FULL-HISTORY-DATA-DEEPARCHIVE-1d",
"Filter": {
"Prefix": "HISTORY/DATA/"
},
"Status": "Enabled",
"Transitions": [
{
"Days": 1,
"StorageClass": "DEEP_ARCHIVE"
}
]
},
{
"ID": "Hello-CDC-delete-30d",
"Filter": {
"Prefix": "CDC/"
},
"Status": "Enabled",
"Expiration": {
"Days": 30
}
}
]
}
I want to only lookout for the rule IDs containing '-FULL-HISTORY-DATA' and then updating its Status to "Disabled". Rest file remains unchanged. Is there a way to do edit without opening the file using single shell command or sed?
Desired output:-
{
"Rules": [
{
"ID": "DMS-FULL-HISTORY-DATA-DEEPARCHIVE-1d",
"Filter": {
"Prefix": "HISTORY/DATA/"
},
"Status": "Disabled",
"Transitions": [
{
"Days": 1,
"StorageClass": "DEEP_ARCHIVE"
}
]
},
{
"ID": "FOL-FULL-HISTORY-DATA-DEEPARCHIVE-1d",
"Filter": {
"Prefix": "HISTORY/DATA/"
},
"Status": "Disabled",
"Transitions": [
{
"Days": 1,
"StorageClass": "DEEP_ARCHIVE"
}
]
},
{
"ID": "Hello-CDC-delete-30d",
"Filter": {
"Prefix": "CDC/"
},
"Status": "Enabled",
"Expiration": {
"Days": 30
}
}
]
}
I have tried using sed , but that is performing update to all rule ids.