I have a txt: a.txt
A
a
B
b
Ş
ş
I try this command and I get false output:
$ uniq -ic a.txt
2 A
2 B
1 Ş
1 ş
How can I solve the non-ascii character problem with uniq?
here is my full-code:
function show_authors() {
id=0;
sqlite3 $db_file "SELECT author FROM books;" > /tmp/.list.txt
sort /tmp/.list.txt | uniq -ic > /tmp/.listed.txt
while IFS=" " read -r count author
do
cat <<EOT
<a href="#$id">$author</a> ($count),
EOT
id=$(($id + 1))
done < /tmp/.listed.txt
}
cat <<EOT
<div id="author">
$(show_authors)
</div>
EOT
My code is correctly working in shell but not correctly working in a CGI-Bash subshell.