Thanks for your reply the script which you given is working as per my requirement. The only problem is after updating the Value position is changing as below.
{
“Comment”: “optional comment about the changes in this change batch request”,
“Changes”: [
{
“Action”: “CREATE”,
“ResourceRecordSet”: {
“Name”: “diksit.rezopiacloud.com”,
“Type”: “A”,
“TTL”: 300,
“ResourceRecords”: [
{
“Value”: “5.6.8.8”
}
]
}
}
]
}
How to update the value without changing its position
The script was changed to work with tabulation, would that be your question?
#!/bin/bash
printf "Enter the IP:"
read IP
if [ -n "$IP" ]; then
TAB=$'\t\t\t\t\t\t'
sed -i '' -e "s/.*Value.*/${TAB}\"Value\": \"$IP\"/g" file.json
fi