find a file's encoding
See which character encoding a text file is in, and convert it to UTF-8.
text
steps
-
file -i file.txtthe kind of file and its charset (macOS: file -I)
-
iconv -f ISO-8859-1 -t UTF-8 in.txt > out.txtconvert it to UTF-8
-
iconv -lthe encodings iconv knows
-
uchardet file.txta better guess, if uchardet is installed
notes
- No tool can be sure of an encoding: it is a guess from the bytes.
commands used
fileiconv
Each has a page in lore: lore file opens it.
add up numbers in a file
Sum a column of numbers, from a file or a command's output.
compare two folders
Find which files differ between two folders, or are only in one of them.
count lines of code
How many lines of code a project has, in total and by language.
count lines, words and files
Count the lines of a file or of a command's output, the words, and the files in a folder.