1748270 Members
3969 Online
108760 Solutions
New Discussion юеВ

Re: file type madness

 
SOLVED
Go to solution
Bernie Vande Griend
Respected Contributor

file type madness

Mystery: We have a application that creates an ascii based file that is set up for DOS/Windows use (it has the extra line feed). This file is then being imported into a MS Access database. Something happened this past weekend to the way this file is created, but I can't trace it back. If I compare the 2 files, I see no differences, each is ASCII type, each has the same permissions, the same extra line feeds, etc. If I ftp both over to Windows in binary mode, both files can be read by Excel, Word, and NotePad, but only the older one is directly recognized by an import into Access. If I go into Notepad and save the newer file as either ANSI or Unicode, then it can be read into Access. There must be something different to the file on the HP side, what am I missing?? Is this file attribute issue or a format issue within the file that I'm just not seeing?
Ye who thinks he has a lot to say, probably shouldn't.
8 REPLIES 8
Helen French
Honored Contributor

Re: file type madness

Just a thought:

How do you import the files to the Windows box? Check and see if the file transfer mode from HP has been changed (binary, ascii) ?
Life is a promise, fulfill it!
Leif Halvarsson_2
Honored Contributor
Solution

Re: file type madness

Hi,
Is it only one file you have problem with ? It may contain some unprintable character. With some work with xd it should be possible to find them or with tr it is possible to delete character classes (se man page for tr).
Jim Mallett
Honored Contributor

Re: file type madness

Don't rule out the potential for bad records. There may be some import rules set in Access that are expecting a particular format (ie. date) and maybe it is being supplied a bad record.

How big is the file? Can you chop it in half and try to import each half, just to rule out the potential of one or two bad records.

Jim
Hindsight is 20/20
Radim Jarosek
Regular Advisor

Re: file type madness

Hi,

Shiju has right, I had similiar problem in past. Had problem with reading files from Unix in Windows. Problem was in binary transfer mode. Check again uploading way.

When you create new third file, is it the same situation ?



Radim
Bernie Vande Griend
Respected Contributor

Re: file type madness

Both files are being ftp'd accross in binary mode. There is an automated process that does this each night, but I did it today manually with the same results to verify.
It is one file, but it is a file that is created from scratch each night. I will try to use xd and/or tr to try to find something, but its a lot like looking for a needle in a haystack. Any ideas on how to make this easier with xd, od, or tr are welcome.
Ye who thinks he has a lot to say, probably shouldn't.
Leif Halvarsson_2
Honored Contributor

Re: file type madness

Hi,
Try tr -d [:class:] .
if you delete all alnum and blank character each line should contain only cr and lf. Then you can use xd -tc th check the file.
Darren Prior
Honored Contributor

Re: file type madness

Hi,

I'd take Jim's idea a step further. Is it possible to just try importing the first line or 2 from the file? Chop it down in vi or with head and then you have a much smaller area to investigate.

regards,

Darren.
Calm down. It's only ones and zeros...
Bernie Vande Griend
Respected Contributor

Re: file type madness

Figured it out. I found out that whenever I tried to save the broken file with vi, it kept saying file exists, use :w! to overwright. I then found that if I did that, without making any other changes that it worked. I then used diff to identify the lines that were different and xd -c to look at those lines and discover that there were 3 null characters in the middle of those lines. Apparently :w! removes null characters. Thanks to everyone for your help, I'll try to figure out how to assign points now!
Ye who thinks he has a lot to say, probably shouldn't.