Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to remove quotes ["] from a specific field in a.txt file 1

Status
Not open for further replies.

awaria

IS-IT--Management
Sep 16, 2010
100
0
0
US
I have a integration utility that takes a tab delimited .txt file and imports the records (purchase Order line item data) into our ERP.

Issue is, the one field [Item Description], many of the records have quotes ["} in the description and
the import utility is fails on these records.

Is there a way to open the file, remove the quotes from the item Description field, and then save the file without the quotes,
then run the import utility?

I am not a programmer, so please take that into consideration when providing suggestions.

Thank you,

zaw
 
A non-VBA way is to open the file in Word or other word processor, Find/Replace the " and save-as a text file.
 
This import process is automated so I am looking for a solution that I can automate.

Thanks for the reply.

zaw
 
Do you want to remove all quotes from the file, or only those in this specific field?

Can you provide a sample of what this data looks like (fictional data is OK as long as the format it is in reflects the real data format).
 
File is attached. The issue has been discovered in the item description field, however, it could be a problem in any field.

Appreciate your help.

zaw
 
Not sure if I did the attachment correctly,I will try again.




 
You have to upload your file to someplace on the web and enter the URL in the "Attachment" field here. You cannot paste a local file...

Do you just want to delete all double-quotes?

Code:
Const ForReading = 1, ForWriting = 2
Set fso = CreateObject("Scripting.FileSystemObject")
sDataFile = "C:\trashandtemp\myfile.txt"
Set f = fso.OpenTextFile(sDataFile, ForReading)
sData = Replace(f.ReadAll, """", "")
Set f = fso.OpenTextFile(sDataFile, ForWriting, True)
f.Write sData
 
guitarzan said:
You have to upload your file to someplace on the web and enter the URL in the "Attachment" field here. You cannot paste a local file...

Or just copy and paste a few lines into the reply box. We just need some representative data to see what you are dealing with and make appropriate suggestions.
 
yes, on deleting all double quotes.

There are 21 fields.
PONumber PODate POType VendorID Vendname ItemID ItemDescr Qty Price Freight Distribution SiteID UofM RequestorID Note Company Campus Address1 City State Zipcode

All will not have any quotes, other than, [Item description] and [Notes].

zaw
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top