I'll suggest the following simple script : cd /D P:\zz1 for %f in (*-T.dly) do tail -n 3 %f > ..\zz2\%f
remember you have to change %f to %%f if you store the script in a .BAT or .CMD file 2009/11/13 lesv99 <[email protected]> > > > > > Thanks. "Tail.exe" sounds like a good idea but I have problems with > outputting data to multiple files. As long as I output data to the command > console everything works fine. Below is an example of outputting the last > three lines of data from all the files in a folder to the console, with the > following command: > > tail -n 3 P:\zz1\*-T.dly > > http://img199.imageshack.us/img199/7100/11132009170036.png > > Outputting data to a single file in another folder works ok too: > > tail -n 3 < P:\zz1\ZMT-T.dly > P:\zz2\ZMT-T.dly > > http://img689.imageshack.us/img689/7116/11132009171219.png > > However, neither of the following two commands would work: > > tail -n 3 < P:\zz1\*-T.dly > P:\zz2\ > > tail -n 3 < P:\zz1\*-T.dly > P:\zz2\*-T.dly > > I'm wondering how to "copy" multiple files from one folder to another in > such a way that the files in the second folder will only show the specified > number of last lines (last two, last three, etc). > > > --- In [email protected] <amibroker%40yahoogroups.com>, Robert > Chevallier <robert.chevall...@...> wrote: > > > > Another way could be to use the "tail" utility in a command line batch > (see > > for instance http://sourceforge.net/projects/unxutils/) > > and use to 1st create files with just the last line (tail -n 1 * > > file-alllines* > *file-lastline* ) > > and use these files for import > > > > 2009/11/13 lesv99 <ebsn247...@...> > > > > > > > > > > > > > > > > > > If there is no way to do it with ASCii Importer then how about > importing > > > data using AFL? You would just need a "for" loop like the one below to > > > extract the last line in the data array, but I don't have a clue about > the > > > rest of the code needed for importing data (if it's possible at all), I > > > couldn't find any examples in AFL Library: > > > > > > for( i = BarCount-1; i < BarCount; i++ ) > > > > > > I export data using AFL all the time, here is example (the code is > based on > > > Graham Kavanagh's code from AFL Library): > > > > > > http://img44.imageshack.us/img44/7641/11122009212131.png > > > > > > > > > --- In [email protected] <amibroker%40yahoogroups.com><amibroker% > 40yahoogroups.com>, "lesv99" > > > > <ebsn247lsm@> wrote: > > > > > > > > Is there a way to import only the last line from ASCii data file? > > > > > > > > This option could be expected in $SKIPLINES command, but I don't see > it > > > there. > > > > > > > > The data file format is as follows (file name = ticker symbol): > > > > > > > > Date,Open,High,Low,Close,Volume,OpenInt > > > > > > > > 11/09/09, 2.4500, 2.5100, 2.4500, 2.5000, 1137245, 652 > > > > 11/10/09, 2.5500, 2.7300, 2.5500, 2.6300, 837775, 510 > > > > 11/11/09, 2.75, 3.49, 2.73, 3.27, 6465800, 489 > > > > 11/12/09, 3.19, 3.56, 3, 3.16, 4803500, 742 > > > > > > > > Format definition file to import all lines of data looks like this: > > > > > > > > $FORMAT Date_MDY, Open, High, Low, Close, Volume, OpenInt > > > > $SEPARATOR , > > > > $SKIPLINES 2 > > > > $AUTOADD 1 > > > > $CONT 1 > > > > $DEBUG 1 > > > > $BREAKONERR 1 > > > > > > > > How to import the last line only: > > > > > > > > 11/12/09, 3.19, 3.56, 3, 3.16, 4803500, 0 > > > > > > > > > > > > > >
