Revision 6aa5a79cad8680a41a1f3820cf2bbbf18c6c9be6 authored by Ieva on 14 December 2022, 10:53:25 UTC, committed by GitHub on 14 December 2022, 10:53:25 UTC
* initial commit

* clean up

* fix a bug and add tests

* more tests

* undo some unintended changes

* undo some unintended changes

* linting

* PR feedback - add user ID to search options

* simplify the query

* Apply suggestions from code review

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* remove unneeded formatting changes

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
1 parent d9d94eb
Raw File
stripnulls.sh
#!/bin/bash

# Strip all null values from dashboards within devenv for some particular
# schema version. Must be run from Grafana root.

# OSX users need to install GNU sed: `brew install gsed`
SED=$(command -v gsed)
SED=${SED:-"sed"}

FILES=$(grep -rl '"schemaVersion": 3[3456789]' devenv)
set -e
set -x
for DASH in ${FILES}; do echo "${DASH}"; grep -v 'null,$' "${DASH}" > "${DASH}-nulless"; mv "${DASH}-nulless" "${DASH}"; done
for DASH in ${FILES}; do grep -v 'null$' "${DASH}" > "${DASH}-nulless"; mv "${DASH}-nulless" "${DASH}"; done
# shellcheck disable=SC2016,SC2002
for DASH in ${FILES}; do cat "${DASH}" | $SED -E -n 'H; x; s:,(\s*\n\s*}):\1:; P; ${x; p}' | $SED '1 d' > "${DASH}-nulless"; mv "${DASH}-nulless" "${DASH}"; done
back to top