Den folgenden Code kann man noch optimieren indem man comm benutzt. Aber dann geht natuerlich der ganze schoene bash Code als Beispielcode floeten
Code
# compare two files and return lines in first file that are missing in second file
#declare -a MISSING='()'
#m=0
#while IFS='' read -r LINE || [[ -n $LINE ]]; do
# if [[ -z $LINE ]]; then
# continue
# else
# FOUND=$(sed -n "/^$LINE\b/{p;q}" $previous_updates)
# [[ -z $FOUND ]] && MISSING[$m]="$LINE" && ((m++))
# FOUND=""
# fi
#done < $new_updates
MISSING=( $(comm -3 $previous_updates $new_updates) )
m=${#MISSING[@]}
Alles anzeigen