csv - How do I stop bash from adding ^@ before each letter in vim -


a problem occured no reason, in code worked previously.

there data in myfile.csv

mp 0,20,60,200,60,95,100,1,20,50,30,20,20,250,115,200,0,8,85,150,465817  mp 1,17.89,60,200,60,93.945,100,1,20,50,30,20,20,250,115,200,0,10,85,150,465927  mp 2,16.33,60,200,60,93.16,100,1,20,50,30,20,20,250,115,200,0,12,85,150,464987  mp 3,15.12,60,200,60,92.56,100,1,20,50,30,20,20,250,115,200,0,14,85,150,463440  ... 

i extracted last 25 lines of files

tail -n 25 myfile.csv > test1.txt 

when

cat test1.txt  ... mp 16,20,60,200,60,95,100,1,20,120,30,20,20,250,115,200,0,8,85,150,529469 mp 17,20,60,200,60,95,100,1,20,130,30,20,20,250,115,200,0,8,85,150,534335 

no problem... want go in text editor, every letters preceded ^@ :

vim test1.txt  ^@m^@p^@ ^@0^@,^@2^@0^@,^@6^@0^@,^@2^@0^@0^@,^@6^@0^@,^@9^@5^@,^@1^@0^@0^@,^@1^@,^@2^@0^@,^@5^@0^@,^@3^@0^@,^@2^@0^@,^@2^@0^@,^@2^@5^@0^@,^@1^@1^@5^@,^@2^@0^@0^@,^@0^@,^@8^@,^@8^@5^@,^@1^@5^@0^@,^@4^@6^@5^@8^@1^@7^@ 

and problem want make pattern search ( first word of line ) doesn't seem work because of

home > awk '/mp 0/{print}' test1.txt home >  

moreover put parameter in awk :

home > cat mp 0 home > awk "/mp `cat mp`,/{print}" test1.txt home >  

do know error comes ?

thank

edit

the .csv file saved in excel 2007 "csv (dos)"

by saving "csv" works => encoding different

otherwise, when opening in vim, :e ++enc=utf16 reload file utf-16 encoding, (assuming nullbytes disappeared) :set fenc=utf-8 , save file. ( thank @l3viathan answer )

i think encoding messed up. file saved utf-16 encoding, reason byte-order mark (0xfeff) missing.

after opened in vim, :e ++enc=utf16 reload file utf-16 encoding, (assuming nullbytes disappeared) :set fenc=utf-8 , save file.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -