[Solved] Linux — 9 — txt files are copied from windows to Linux and read error

Reason: different coding methods


Modify the CFG configuration file in Linux, create a new CFG text file, copy and paste it into the new CFG. File file name to view the encoding method of the file.

How to convert in Linux?

Convert CFG files in folders 1 and 2 [UTF-8 (with BOM) to UTF-8]:


function cfg_change()
	find $dir -type f -name "cfg.txt" -print | xargs -i sed -i '1 s/^\xef\xbb\xbf//' {}
	echo "-------Convert Succeed-------"
	file ./etc/xxx/"$1"/cfg.txt

case "$1" in
		cfg_change 1;
		cfg_change 2;
		echo "Usage: $0 -1|-2"

exit 0

Read More: