Last active
November 18, 2025 16:53
-
-
Save lhns/4d6c5c1f7fc209d0b91730339f81f4f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| casadm -L -o csv | grep -oP '(?<=^cache,)\d+' | while IFS= read -r cache_id; do casadm -P -i "$cache_id" -d -o csv | jq -sR 'split("\n")|map(split(","))|.[0] as $headers|.[1:]|map(select(length > 0)|with_entries({key: $headers[.key]|ascii_downcase|gsub("[^a-z%]+"; "_")|trimstr("_"), value: .value}))' | jq -r --arg cache_id "$cache_id" 'map(. as $obj|del(.io_class_id, .io_class_name)|to_entries|map("opencas.\(.key){opencas.cache_id=\"\($cache_id)\",opencas.io_class_id=\"\($obj.io_class_id)\",opencas.io_class_name=\"\($obj.io_class_name)\"} \(.value|rtrimstr("%")|tonumber)")[])[]'; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment