[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: global merging xy



Reply to note from "Morris Krok"  Sun, 16 Nov
2003 10:22:00 +0200

Morris:

> I would like to know whether there is a program in U2 which
> enables the global merging of files in a directory, i.e. all
> the files sequentially into a specific file for the purposoe of
> consolidating them - say for instance the chapters of a book.

Yes, there is. The command is: MEALL [filespec].

For example, if you have files named CHAPTER.1, CHAPTER.2, etc. in
directory D:\MYBOOK, you'd issue:

MEALL d:\mybook\chapter.*

To MErge files from more than one directory, list them in the order
you want, separated by commas. For example:

MEALL d:\mybook\chapter.*,e:\mynotes\note.*

That MErges all of the CHAPTER files, followed by all of the NOTE
files.

To insert a divider with the filename at the start of each MErged
file, append switch /F to the command (frame) name:

MEALL/F d:\mybook\chapter.*

> I would imagine that the first step would be to change the
> format of a directory...

You mean force 8.3 filenames with DIR/NA/FI? What for? In any
case, MEALL uses func EN (Edit Next file), not a DIRectory listing.
EN opens files in alphabetical order, which is usually what is
required for these purposes (at least, for my purposes).

Nevertheless, basing the program on a DIRectory procedure is an
interesting idea, and feasible. It would add options with regard to
sequencing; files would be MErged according to the prevailing sort
order (as set by the DSORT command). If you write the program that
way, there would be no need to tinker with the directory's format;
just grab each filename from the list with . Assuming
directory in the current window and output file in the alternate
screen, the core procedure would be:

>BX exist Q2 )>AS BX me Q2
BX waitQ2 AS LD 

The rest is left as an exercise. However, unless your name is
Pinter, I'm not sure why you'd ever want to MErge your chapters in
reverse order or in the other sequences that DSORT would allow.

--
Carl Distefano
cld@xxxxxxxx