Stripping out hex codes from text file

  • Thread starter Thread starter DubboPete
  • Start date Start date
D

DubboPete

Hi all,

I have a text file which needs to be imported into a db. The file
structure unfortunately contains extra characters in the various fields
that are generated by the ancient program that exports the text file.

is there a way to strip out hex codes, underscores, or ascii characters
such as alt-0143 (), and so on, just leaving the raw data?

Any help/guidance/pointers to knowledgebase much appreciated.

DubboPete
 
Hi Pete,

This kind of a thing can eb done in Visual Basic. This text file is a comma
seprated file right?

Here is what you do, open the text file, assign the first line to a
variable, usign a combination of mid$(<string>,<star value>,instr$(<the
arguments>)) you can search if the line has hex value, or the other values,
remove them, then add a new record to the access table, open the access table
suing automation and, break the string into different fields and add it to
the database.

Another approcah is that read word by word, again usign the same
mid$(<string>,<star value>,instr$(<the arguments>)) combination and check if
the value is a hex or any other character that you don't want, if they both
match don't add to the table, if they match you can add them to the table.

I suggest access automation using vb becuase if you open it using a data
control or odbc driver, it might not allow the kind of flexiablity that might
be needed.

Hope you found this information useful.

Anand
 
Back
Top