Some advice to add records in ASCII Data files.

#1
Is there any utility or can anybody develop a small script file or a program to
Append records from a master file to different child files. Better if this is Command line utility. (msdos prompt)

All the files are in ASCII format and are in the same folder or directory

format of <Master.TXT> file

<DATE><SYMBOL><OPEN><LOW><HIGH><CLOSE><VOLUME> /(header)
09212006,SBIN,950.00,945.00,980.35,971.60,236758 /(Date MMDDYYYY)
09212006,SAIL,73.00,70.10,74.80,71.60,4236758
09212006,ACC,930.00,925.00,980.35,971.00,4236759

Format of different child files

1. sbin.TXT file

<DATE><SYMBOL><OPEN><LOW><HIGH><CLOSE><VOLUME>
09192006,SBIN,940.00,935.85,966.50,962.00,135024
09202006,SBIN,963.00,940.80,963.50,949.00,235852

2. sail.txt file

<DATE><SYMBOL><OPEN><LOW><HIGH><CLOSE><VOLUME>
09192006,SAIL,70.00,68.85,73.50,72.00,2135024
09202006,SAIL,73.00,64.80,79.50,71.00,235852

From the Master.txt file each record has to be appended in different txt files.

The utility or the software should seek the name of the files which is matching the symbol field (omit the extention of the file .txt) of the master file only in the Folder or Directory specified.

It should add the record of the child file at the end of the file. If any date is duplicated it should overwrite the record in the child text file.

If there is no child file it should create a new child file with .txt as extention of the file. (ACC is in master but child file do not exists - Acc.txt file with one record should be created - in the folder name specified.

The result of running the utility is as follows

Master.txt file

<DATE><SYMBOL><OPEN><LOW><HIGH><CLOSE><VOLUME>

1. sbin.txt file

<DATE><SYMBOL><OPEN><LOW><HIGH><CLOSE><VOLUME>
09192006,SBIN,940.00,935.85,966.50,962.00,135024
09202006,SBIN,963.00,940.80,963.50,949.00,235852
09212006,SBIN,950.00,945.00,980.35,971.60,236758


2. sail.txt file

<DATE><SYMBOL><OPEN><LOW><HIGH><CLOSE><VOLUME>
09192006,SAIL,70.00,68.85,73.50,72.00,2135024
09202006,SAIL,73.00,64.80,79.50,71.00,235852
09212006,SAIL,73.00,70.10,74.80,71.60,4236758

3. acc.txt file (new file is generated or created)

<DATE><SYMBOL><OPEN><LOW><HIGH><CLOSE><VOLUME>
09212006,ACC,930.00,925.00,980.35,971.00,4236759


I believe that i have given the requirement quiet clearly - if any other clarifications, Please post.

Thanks

anil
 

Similar threads