Created
April 10, 2019 13:02
-
-
Save thibmaek/0244b4a289a7476749af0fe5675b33a0 to your computer and use it in GitHub Desktop.
InfluxDB: parse shell string fields
This file contains 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
payload="" | |
fields=("d=2" "f=3") | |
for field in "${fields[@]}"; do | |
key=$(echo "$field" | sed 's/=.*//g') | |
value=$(echo $field | awk -F= '{print $2}') | |
echo $key | |
echo $value | |
payload="$payload $key=\"$value\"" | |
done | |
echo $payload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment