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

MEALL - U2 routine to MErge multiple files



Morris et al.:

On further consideration, it didn't make sense to have different
commands (MEALL and MEDIR) to MErge files alphabetically and
according to the current directory sort (DSORT) order, much less to
use two different internal procedures (func EN and MErge from
DIRectory listing) to do these things. One command (MEALL) and one
procedure (MErge from DIR) will suffice. So I've rewritten MEALL to
eliminate the redundancies -- and added some new power in the
process.

The default sort order continues to be alphabetical by filename.ext
(F,E). That, I think, is the order that most people would find
useful most of the time (because most file-naming schemes are
alphabetical or numerical -- at least, mine are).

Here are the available commands; the examples assume a group of
files named CHAPTER.1, CHAPTER.2, and so on, in the current
directory:

MEALL chapter.*
Files are MErged in alphabetical order by filename.ext (CHAPTER.1,
CHAPTER.2, etc.)

MEALL/D chapter.*
Files are MErged in the current Directory sort (DSORT) order

MEALL/D:d,r chapter.*
Forces files to be MErged in the specified sort order (here, Date,
Reverse -- i.e., newest files first). Switch /D: accepts all of the
sort specs accepted by the DSORT command; the current DSORT order is
not affected

Switch /F can be added to any of these commands to insert a header
with the d:\path\filename before each MErged file:

MEALL/D:f,e,r/F chapter.*
Files MErged in reverse alphabetical order by filename.ext(!);
d:\path\filename header inserted before each MErged file

Switches can be strung together or separated by spaces; the
following are all equivalent:

MEALL/D:d,r/F chapter.*
MEALL /D:d,r/F chapter.*
MEALL /D:d,r /F chapter.*
MEALL /D:d,r chapter.* /F

Here's the revised frame MEALL, along with an updated Help screen.
Decode the entire block (DECODE), add frame MEALL to U2 and
CoPy the Help screen into XYWWWEB.INF, replacing the earlier
version.

Enjoy! Comments welcome.

XPLeNCODE v2.0
b-gin [UNTITLED]
U2 frame:[cr|lf][cr|lf]{{;5MEall*}} MErge all files that matc
h given filespec(s) [v2; CLD rev. 12/2/03][cr|lf]{002}[XH_]{<
}IF{<}VA|50{>}<1{>}{<}PRMEALL[/D[:a[,b]]][/F] [filespec1[,fil
espec2,...]]{>}{<}EX{>}{<}EI{>}[BX_]es 0[Q2_]{<}SU01
,{<}SX02,{<}VA$WA{>}{>}{<}IF{<}PV02{>}<1{>}{<}PRNo window{>}{
<}EX1{>}{<}EI{>}[BX_]func #{<}PV02{>}[Q2_]{>}{<}IF{<}VA$WS{>}
<>1{>}{<}GT01{>}[BX_]ne/100[Q2_]{<}EI{>}[GT_][DX_]{<}PRWorkin
g{>}{<}GT01{>}{<}SX03,@upr({<}VA$FR{>}){>}{<}SV04,/{027}W {>}
{<}LBa{>}{<}IF{<}IS50{>}{240}"/"{>}{<}SV05,{>}{<}XS50,04,06,0
7,05{>}{<}IF{<}VA|06{>}<0{>}{<}SX50,{<}IS50{>}+" "{>}{<}GLa{>
}{<}EI{>}{<}SX03,{<}IS03{>}+@upr({<}IS07{>}){>}{<}SX50,{<}IS0
6{>}+{<}IS05{>}{>}{<}GLa{>}{<}EI{>}{<}SU04,{<}SX05,{<}VA$SD{>
}{>}{<}IF{<}VA|05{>}<1!({<}IS05{>}+"{014}"){240}",{014}"{>}{<
}SX05,{<}IS05{>}+"H"{>}{<}EI{>}{>}{<}IF"/D"{238}{<}IS03{>}<0{
>}{<}SX03,{<}IS03{>}+"/D:F,E"{>}{<}EI{>}{<}IF{<}IS03{>}{240}"
/D"&"/D:"{238}{<}IS03{>}<0{>}{<}GT04{>}{<}SV06,/D{>}{<}SV07,{
>}{<}XS03,06,06,,07{>}{<}SX03,{<}IS06{>}+"/D:"+{<}IS05{>}+{<}
IS07{>}{>}{<}EI{>}{<}SV05,{>}{<}SX06,{<}VA@03:2{>}{>}{<}IF{<}
IS06{>}{240}"/"{>}{<}SX06,{<}VA@06/1{>}{>}{<}EI{>}{<}GT04{>}{
<}SX05,"[BX_]dsort "+{<}IS05{>}+"[Q2_]"{>}[BX_]dsort {<}PV06{
>}[Q2_]{<}SV06,,{>}{<}SX07,0{>}{<}LBb{>}{<}IF{<}VA|50{>}>0{>}
{<}IF","{238}{<}IS50{>}<0{>}{<}SX04,{<}IS50{>}{>}{<}SV50,{>}{
<}GLc{>}{<}EI{>}{<}SV08,{>}{<}XS50,06,04,,08{>}{<}SX50,{<}IS0
8{>}{>}{<}LBc{>}{<}GT01{>}[BX_]dir/fi {<}PV04{>}[Q2_]{<}IF{<}
ER{>}{>}{<}GLb{>}{<}EI{>}{<}LBd{>}{<}SX02,{<}VA$DR{>}{>}[BX_]
exist {<}PV02{>}[Q2_]{<}IF@not({<}ER{>}){>}[AS_]{<}IF{<}IS03{
>}{240}"/F"{>}{<}SX08,"|- "+{<}IS0
2{>}+" ->[cr|lf]"{>}{<}IF{<}CP{>}>0{>}{<}SX08,"[cr|lf]"+{<}IS
08{>}{>}{<}EI{>}{<}GT08{>}{<}EI{>}[BX_]me {<}PV02{>}[Q2_][BX_
]wait[Q2_]{<}SX07,{<}PV07{>}+1{>}[DO_][DX_][AS_][LD_]{<}GLd{>
}{<}EI{>}[BX_]ab/nv[Q2_]{<}GLb{>}{<}EI{>}{<}IF{<}VA$WS{>}<>1{
>}[BX_]rs[Q2_]{<}EI{>}{<}PV05{>}{<}SX01,"Done: "+{<}IS07{>}+"
 files MErged"{>}{<}PR@01{>}{002}[cr|lf][cr|lf]----------[cr|
lf]Help screen:[cr|lf][cr|lf]{MEall,MErgeAll,MErge All}[cr|lf
][cr|lf]MEALL.PM -- C.L.Distefano 12/6/01 (v2; rev. 12/2/03)[
cr|lf][cr|lf]MErge sequentially, at cursor position, all file
s matching one or more wildcard specifications[cr|lf][cr|lf]U
sage[cr|lf]-----[cr|lf]MEALL[/D[:a[,b]]][/F] [filespec1[,file
spec2,...]][cr|lf]Default file sort order is alphabe
tical by FILENAME.EXT (F,E)[cr|lf]Switch /D = use current Dir
ectory Sort order (= [≪_]VA$SD[≫_]= {<}VA$SD{>}) as previou
sly set by the DSORT command[cr|lf]Switch /D:a[,b] = use spec
ified DSORT order (e.g, /D:s,r = reverse size order); this sw
itch does {<}MDIT{>}not{<}MDNM{>} alter [≪_]VA$SD[≫_][cr|lf
]Switch /F = insert a header with D:\PATH\FILENAME at the beg
inning of each MErged file[cr|lf][cr|lf]Examples[cr|lf]------
-[cr|lf]MEALL d:\book\chapter.*[cr|lf]> MErge all fi
les matching the specification CHAPTER.* (e.g., CHAPTER.01, C
HAPTER.02, ...)[cr|lf][cr|lf]MEALL/D c:\xy\*start*.int[cr|lf]> MErge matching files using the current DSORT order
 ({<}VA$SD{>})[cr|lf][cr|lf]MEALL/D:s,r/F e:\xpl\*.pm[cr|lf]> MErge matching files in reverse size order (largest
 first); insert header with D:\PATH\FILENAME at the start of{032}
each MErged file[cr|lf][cr|lf]Notes:[cr|lf]1. Requires one av
ailable window in addition to current window.[cr|lf]2. If fil
e is not open in current window when MEALL is launched,[cr|lf
]  files are MErged into an Untitled file (opened by frame M
EALL).[cr|lf]3. During operation, if PRompted with "File is a
lready{032}
open--open again? (Y)es,(N)o,(G)o,(R)ead", choose (R)ead.[cr|
lf][cr|lf][cr|lf]For Use by RENUMBER:[cr|lf]Default Save/Get{032}
Range = 01-08, 50[cr|lf]Renumber MEALL in PACK mode; FREEZE 5
0[cr|lf][cr|lf]-{tab}-{tab}-{tab}-{tab}-{tab}-{tab}-{tab}-{ta
b}-{tab}-[cr|lf][cr|lf]
-nd
XPLeNCODE

--
Carl Distefano
cld@xxxxxxxx