I have been trying to FTP some data files from Windows directory to a UNIX server. The txt file in the windows contails the following data:
"111~XYZ~1~Contact person’s phone number~COMMENTS~~~~"
but the same line is appearing as
"111~XYZ~1~Contact person^Òs phone number~COMMENTS~~~~" in unix server.
The ' character is appearing as ^Ò in the unix file. Kindly suggest a way to FTP the files w/o distorting the characters.
I tried FTPing in the binary format by using type binary on ftp prompt but still the file is being FTPed with the junk character. Also after executing the command :1,$s/\^Ò//gp in vi editor, i am getting the following error "ex: 0602-071 No match exists for the substitute pattern."
dos2unix -- and FTP ASCII mode -- generally only handles line ending convention translations. The file is in a Windows character set; you need to convert it to whatever you are currently using. We can only guess what you would like it to be, and what the original character set is, but have a look at recode and iconv. If you don't have them installed locally, they are available on the Internet. Or if you have a strong stomach, use Windows and "save as" into a sane file format.
For a quick and dirty solution, find out the octal character code of the problematic character (od gives you a basic dumping facility, but it's a bit hard to read -- try piping in just a single line, rather than od:ing the whole file; or if you have xxd or hexdump, you can get more readable output, albeit in hex, not octal) and tr allows you to substitute it with something else.
I'm only using \222 as an example here; the character you want to find is most likely something else.
Don't assume there aren't other "funny" character codes in the file. As a matter of fact, there probably are.
Last edited by era; 03-25-2008 at 07:37 AM..
Reason: Clarify that 222 is just an example
On another note, the vi tip would probably work if you could copy/paste the problematic sequence instead of typing in whatever it is you think you are seeing. The people here who are trying to help might not be using the same character set as you, so just to be unambiguous, it would help to know the character codes of the problematic character(s) in order to help you.
Hi All,
I have a issue that we are getting Junk characters from source and i am not able to load that records to Database.
Line breakers
Junk Characters (Â and different every time)
Japanese Characters
Every time I am using grep command and awk -F "\007" to find them and delete that... (1 Reply)
Hello All,
I have issues in unix file when I loaded that to database and do select * from table where description like '%'+char(13)+'%' on it I am able to get records. I tried to view the file in unix it is all having blank character which I think is all non ascii which I am not able view.... (11 Replies)
Hi
I want to know how to see junk character in a file.
i am not able to see junk character using vi or cat command.
below is the junk char . which i see in host file
10.178.14.67▒▒▒ ac01sp02-vip
actually it should be like this
10.178.14.67 ac01sp02-vip
i am using secure CRT... (11 Replies)
Dear ALL,
How to remove junk charecter ^M from unix file i am using sun solaris unix.
I already tried few commands
:%s/^M//g
:%s/r//g
but it didnt helped me.
Any help appriciated.
Thanks
Ripudaman
Please view this code tag video for how to use code tags when posting code... (5 Replies)
Hello,
I have two .sql files which I transferred from Windows to Unix (Linux Enterprise Linux Server release 5.3).I want to ensure that these two files have no junk characters in them.How do I do it in the simplest possible way?
Many thanks
DJ (1 Reply)
I wanted to remove junk char in my csv. :mad:
Input file format:
"17","9986782190","0","D","2"
"17","9900918331","0","D","2"
"13","9986782194","0","A","2"
Output file format
9986782190
9900918331
9986782194
And one more thing all the time "13"," this will be different Ex: . (2 Replies)
Hi All
I have a rather unusual problem, which i have not faced till now. I have a script which exports some paths to a text file. The script runs fine but when i check the output file i can see some junk characters ^M appended at end of lines and random places. I am not able to figure... (4 Replies)
Hi Team,
I have a file having size greater than 1 GB. What i want to do is to check if it contains any JUNK character (ie any special charater thats not on the key board stroke). This file has 532 column & seperated with ^~^.
I have found some solution from the file, but it is for a... (4 Replies)
Hi
set filename "./GopiRun.sh"
if } err] {
writeLog "error in exec "
writeLog $a
} else {
writeLog $a
}
The above code will execute a file GopiRun.sh,and will log the output of the exec to a file.
The problem is the file has lot of junk character in it,how to avoid it.
The... (2 Replies)
I have a file with one of the following lines, when opened with vi
33560010686GPT£120600GBPGBP10082007DS
In the above line, I want to get rid of the junk character before the £ (pound sysmbol).
When I tried copying £ from windows and copy in unix vi, it prints as £ and I tried pattern replace... (2 Replies)