[NTLUG:Discuss] How to write converted file format from vi?

Rick Renshaw bofh69 at yahoo.com
Thu May 6 18:36:16 CDT 2010


----- Original Message ----

From: Neil Aggarwal <neil at JAMMConsulting.com>
To: NTLUG Discussion List <discuss at ntlug.org>
Sent: Thu, May 6, 2010 5:25:15 PM
Subject: [NTLUG:Discuss] How to write converted file format from vi?

Hello:

I received a CSV file from a data provider, but it has
a lot of non-printing characters in it.  Here is what
the first part of the file looks like when I do a head
on it:

--" 5 " , " 5 0 0 9 0 " , " R 1 0 0 0 0 0 " , " 5 9 1 0 - 0 4 - 0

When I open the file in vi, it displays as normal text:

"5","50090","R100000","5910-04-0

The bottom of the vi window states this:
"t.csv" [converted] 934393L, 181540523C

So, vi did some kind of conversion on it.

I want to write the converted version of the file
out to a new file, so I tried

:w /tmp/test2.txt

but the new file still has the non-printing characters.

Is there a way to tell vi to write the version of the file
it converted?

Thanks,    
    Neil

--
Neil Aggarwal, (281)846-8957
FREE trial: cPanel VPS with unmetered bandwidth
http://UnmeteredVPS.net/cpanel

>From the extra spaces, that looks like a Unicode file.  To write it out as a converted file you need to set the file encoding first:

:set fenc=latin1
:wq






More information about the Discuss mailing list