dotfiles/3dprinting/RedENDER3/dedup-ini.bash
2021-01-14 15:00:36 +01:00

14 lines
353 B
Bash

echo > config_bundle_dedup.ini
cat <(sed -e 's/^$/\xBF/' < config_bundle.ini) <(printf '\xBF') | while read -d $'\xBF' var
do
newline=$"\n"
header="$( cut -d $'\n' -f 1 <<< "$var" )"
pairs="$( cut -d $'\n' -f 2- <<< "$var" )"
(
echo "$header"
echo "$pairs" | sort -u -t' ' -k1,1
printf "\n"
) >> config_bundle_dedup.ini
done