vi -b original_file.csv
Usually, this can happen when you try to copy the file from linux to windows and make some changes to the file and then save it.
If you're not sure if the file contains a UTF-8 BOM, then this (assuming the GNU implementation of sed) will remove the BOM if it exists, or make no changes if it doesn't.
sed '1s/^\xEF\xBB\xBF//' < original_file.csv > new_file.csv
You can also overwrite the existing file with the -i option:
sed -i '1s/^\xEF\xBB\xBF//' original_file.csv
***
Other easy Method:
Verify if the file has BOM by
vi -b original_file.txt
Then open file normally with
vi original_file.txt
then do
:set nobomb
:wq
Reverify the file by doing vi -b original_file.txt
***
No comments:
Post a Comment