Check that they're sorted as expected and contain no duplicates. The sort order now uses: $ LC_COLLATE=C sort -f So that non-alphanumeric characters are not ignored, giving a more intuitive sort order. the '-f' means ignore case. Also sort the existing lists accordingly. Test: repo upload Bug: 64382372 Merged-In: I52b884da33a9a46455df6747a215683d9d3c3218 Change-Id: I4cdd3bc5c11be91a9a3f678580af49ac67f3c968
19 lines
348 B
Bash
Executable File
19 lines
348 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
if [ -z "$1" ]; then
|
|
source_list=/dev/stdin
|
|
dest_list=/dev/stdout
|
|
else
|
|
source_list="$1"
|
|
dest_list="$1"
|
|
fi
|
|
# Load the file
|
|
readarray A < "$source_list"
|
|
# Sort
|
|
IFS=$'\n'
|
|
A=( $(LC_COLLATE=C sort -f <<< "${A[*]}") )
|
|
A=( $(uniq <<< "${A[*]}") )
|
|
unset IFS
|
|
# Dump array back into the file
|
|
printf '%s\n' "${A[@]}" > "$dest_list"
|