Google Cloud Platform (GCP)

Delete old snapshots gcloud compute snapshots delete $(gcloud compute snapshots list --filter 'creationTimestamp<=2019-03-03' --format json | jq -r '.[].name')

YAML

# Add or copy a key value pair to file1.yaml yq -i ".newkey += \"example value\"" file1 # Double quote all values yq -i '..style="double"' file1 # Sort keys yq -i 'sort_keys(..)' file1 # Find duplicates yq -P -oprops 'sort_keys(..)' file1 file2 | sort | uniq -d # Deduplicate # Reads file1 and file2, and removes duplicate yaml lines from file2. # Usage: deduplicate file1 file2 function deduplicate { while read -r line; do key=$(echo "$line" | cut -d= -f1) if [[ -z $key ]]; then continue fi yq -i "del(....