Bash | compare two arrays | compare two strings

comm -12 <(printf ‘%s\n’ “${ARRAY1[@]}” | LC_ALL=C sort) <(printf ‘%s\n’ “${ARRAY2[@]}” | LC_ALL=C sort) comm -12 <(printf ‘%s\n’ ${STRING1} | LC_ALL=C sort) <(printf ‘%s\n’ ${STRING2} | LC_ALL=C sort)

BASH vs. JSON :)

curl -s “https://www.pegelonline.wsv.de/webservices/rest-api/v2/stations.json?includeTimeseries=true&includeCurrentMeasurement=true&#8221;| jq -j –tab ‘.[] | select( ( .timeseries[0].currentMeasurement.stateMnwMhw==”low” or .timeseries[0].currentMeasurement.stateMnwMhw==”high” ) and .timeseries[0].shortname==”W” ) | [ .number, .water.longname, .longname, .latitude, .longitude, .timeseries[0].currentMeasurement.stateMnwMhw, .timeseries[0].currentMeasurement.trend, .timeseries[0].currentMeasurement.value ] | “\(.[0])|\(.[1])|\(.[2])|\(.[3])|\(.[4])|\(.[5])|\(.[6])|\(.[7])\n”‘)

bash – read command results into an array

read -a ARRAY <<< $(df -h /data | grep -w /data) OR read -d DELIMITER -a ARRAY <<< $(df -h /data | grep -w /data) THIS DOES NOT WORK FOR ME OR OIFS=$IFS;IFS=$’\|’;read -a ARRAY <<< “$STRING2PROCESS”;IFS=$OIFS # for delimiter ‘|’ OR BETTER (!) ARRAY=($(df -h /data | grep -w /data)) HINT —> OIFS=$IFS;IFS=$’\|’;read -a […]