Batch Files with .txt

July 29, 2009 at 07:10:17
Specs: Windows XP
well, I am new to batch files so I will need a great example for what I am trying to do.

I would like to open a txt file that has the following structure.
1 ,6853495092, BATTERY ,BT1 ,1 ,BAT_1
2 ,6853501749 ,22nF ,C1 ,13 ,C0805_1
C2 ,13 ,C0805_1
C3 ,13 ,C0805_1
C4 ,13 ,C0805_1
C5 ,13 ,C0805_1
C6 ,13 ,C0805_1
C9 ,13 ,C0805_1
C10 ,13 ,C0805_1
C11 ,13 ,C0805_1
C12 ,13 ,C0805_1

and I need to get it in this form
10,6853495092,BATTERY,BT1,1
20,6853501749,22nF,C1,1
20,6853501749,22nF,C2,1
20,6853501749,22nF,C3,1
20,6853501749,22nF,C4,1
20,6853501749,22nF,C5,1
20,6853501749,22nF,C6,1
20,6853501749,22nF,C9,1
20,6853501749,22nF,C10,1
20,6853501749,22nF,C11,1
20,6853501749,22nF,C12,1

as you may see there will be some reading of lines, deletions, adding text
well, any help with this will be appreciated


See More: Batch Files with .txt

Report •


#1
July 29, 2009 at 09:51:56
As ever, a good solution starts with a good problem statement.

What are the rules/criteria?


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#2
July 29, 2009 at 10:00:08
Rules... hummm dare I say there are no rules?!

I would like an app or bat file that can open a txt file can and put it into a format that my database can understand. This may involve openning the old txt modifying the data and then saving it to a new file.

I'm slowing seeing somethings that confort me with batch file: do, for loops :)

I have lots of experience writing firmware and some in php html. I would simple like a way to click an icon that may ask where the file is and then go to work!


Report •

#3
July 29, 2009 at 10:07:54
Looks like you need something to read in a SMT file (probably pick & place). Seems like some type of specialized software would work best.

Report •

Related Solutions

#4
July 29, 2009 at 10:11:25
TRA i am not sure what you are (asking or telling me) to do

Report •

#5
July 29, 2009 at 12:56:48
ok heres a simple question I hope...

when dealing with the format above. can someone show me an example on how to read in a .txt file and tokenize the comma to a variable?


Report •

#6
July 29, 2009 at 16:55:30
What I meant was it looked like you were trying to read in data and convert it to part numbers for a placement machine (used to be a job of mine for 15+ years). We received data from engineers who wished us to manufacture PWB's for them. We first used Excel to convert the data to match our database of parts (and subsequently part numbers) to import to a customized program for the placement machines to understand. You may have better luck using Excel (import the data as comma-delimited text) and the VLOOKUP function to reference the parts (and/or part numbers).

Report •


Ask Question