1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Batch scripting - creating CSV files from a list

Discussion in 'Software Development' started by Zxarr, Nov 8, 2007.

Thread Status:
Not open for further replies.
  1. Zxarr

    Zxarr Thread Starter

    Joined:
    Nov 8, 2007
    Messages:
    1
    Greetings,

    I am trying to write a script that will take a list of items from a file and append them into a CSV file...

    This script will run each day, taking each item from the 'item.txt' file and appending it to the end of the last line of a csv file that is already there:

    The itemlist.csv file looks like this before the items are added:

    Code:
    date,time,foo,bar
    and must look like this afterwards:

    Code:
    date,time,foo,bar,item1,item2,item3,item4

    The number of items in the item.txt file can change each day.

    Now, if this were bash shell scripting, no problems, but I have to do this on a Windows Server...

    Thanks.
     
  2. johnhe

    johnhe

    Joined:
    May 11, 2007
    Messages:
    56
    You could create a text file containing a single comma and then use this batch file to get the result you are looking for.

    @echo off
    copy itemlist.csv + comma.txt + item.txt tmp.csv
    del itemlist.csv
    ren tmp.csv itemlist.csv

    John Hensley
    www.resqware.com
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/649383

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice