awk -F : '$1 ~ /[[:digit:]]+[[:alnum:]]*[[:digit:]]+/ && ($3>6200) {print $5" --- "$1" --- "$3;count++} END{print"\n----------\nSuma znalezionych rekordów:"count"\n----------\n"}' /etc/passwd|iconv -f ISO8859-2 -t UTF-8
So my problem is that when I run the foregoing code in the terminal, iconv command converts the whole input from ISO8859-2 to UTF-8 and therefore - polish diactric signs are not printed correctly.
I changed the main encoding by adding LANG=pl_us.UTF-8 to .bashrc, so I suppose, that the problem appears because the file /etc/passwd is encoded in ISO8859-2 and the printed line is in UTF-8. How to fix that without any changes in .bashrc?