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: Icc124fd8ceb3f001a9c11bbf40e0a111910c6b39
(cherry picked from commit e5dc64d428)
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"
|