Remove temp files usage from sxmo_contacts.sh; & use awk to allow unsorted

master
Miles Alan 5 years ago
parent a032e4923e
commit 917ad2ebfe
  1. 15
      scripts/core/sxmo_contacts.sh

@ -16,14 +16,13 @@ contacts() {
awk '!($0 in a){a[$0];print}' | awk '!($0 in a){a[$0];print}' |
sed '/^[[:space:]]*$/d' sed '/^[[:space:]]*$/d'
)" )"
RECENTCONTACTEDNUMBERSREVCHRONF="$(mktemp)" printf %b "$RECENTCONTACTEDNUMBERSREVCHRON" | awk -F'\t' '
echo "$RECENTCONTACTEDNUMBERSREVCHRON" > "$RECENTCONTACTEDNUMBERSREVCHRONF" FNR==NR{a[$1]=$2; next}
printf %b "$( {
join -t"$(printf '\t')" -o1.1,2.2 -a1 -e"Unknown Number" \ if (!a[$1]) a[$1] = "Unknown Number";
"$RECENTCONTACTEDNUMBERSREVCHRONF" "$CONTACTSFILE" | print $0 ": " a[$1]
sed 's#\t#: #g' }
)" ' "$CONTACTSFILE" -
rm "$RECENTCONTACTEDNUMBERSREVCHRONF" &
} }
contacts contacts

Loading…
Cancel
Save