0
I have some files with Windows line endings and latin-1 encoding that I need to convert to unix line endings and utf-8.
Of course I can
for file in ./*.csv; do
sed s'/^M//' "$file" > "${file}.bak"
iconv -f iso-8859-1 -t utf8 "${file}.bak" > "$file"
rm "${file}.bak"
done
But is there a commonly available tool that can do both of these things at once? Maybe this isn't the most efficient way. (Maybe iconv?)
1I strongly believe the answer is "no", since those two tasks are quite different and it doesn't make sense to write a single tool to perform both tasks at once, particularly where unix philosophy is concerned. But hey, who knows when somebody is crazy enough... – Abel Cheung – 2015-07-11T21:18:48.263