Read/find in CSV file and other simple operations
Posted: 25 Jun 2010 09:32
hi,
still very new to batch. how would I find an entry, say a string "Schedule", in a CSV file and then set it to a variable in my batch file?
for instance, I want to:
1. find "Schedule" in the file "C:\ops\fileA.csv" (I know "Schedule" occurs in col 1 of the CSV)
2. set a string variable, say schedNum, in the batch to the entry in col 2 of the row where "Schedule" occurs
3. open another file, "C:\ops\fileB.csv" and find the row(s) in which schedNum occurs. schedNum will occur in the first col.
4. In the row where schedNum occurs, copy the entries in col 2 and col 3 to two other integer variables in the batch, line1 and line2
5. open a database file "C:\ops\database.mdb" and open a table in it, "Table1"
6. In Table1, add a new row at the end of the table (after the last row that has an entry). Set col1 and col2 to line1 and line2
And I want to be able to do this for several entries (for instance, Schedule1, Schedule2, etc.
I know this is a lot! Since I don't really know the correct commands/syntax, I'm hoping that if someone can help me out then I'll know this stuff next time around.
Thanks a lot
still very new to batch. how would I find an entry, say a string "Schedule", in a CSV file and then set it to a variable in my batch file?
for instance, I want to:
1. find "Schedule" in the file "C:\ops\fileA.csv" (I know "Schedule" occurs in col 1 of the CSV)
2. set a string variable, say schedNum, in the batch to the entry in col 2 of the row where "Schedule" occurs
3. open another file, "C:\ops\fileB.csv" and find the row(s) in which schedNum occurs. schedNum will occur in the first col.
4. In the row where schedNum occurs, copy the entries in col 2 and col 3 to two other integer variables in the batch, line1 and line2
5. open a database file "C:\ops\database.mdb" and open a table in it, "Table1"
6. In Table1, add a new row at the end of the table (after the last row that has an entry). Set col1 and col2 to line1 and line2
And I want to be able to do this for several entries (for instance, Schedule1, Schedule2, etc.
I know this is a lot! Since I don't really know the correct commands/syntax, I'm hoping that if someone can help me out then I'll know this stuff next time around.
Thanks a lot