Subj.: .BTM to imitate 4ZIP util                                                

 > 2) If file DESCRIPT.ION does not exist, you're done. Quit. If
 >    it does exist:
 >
 > 3) Get the comment, using GREP:
 >
 > GREP "^%@lower[%3]" descript.ion >& NUL
 >
 > Use LOWER function to ensure that GREP is looking for a *lower-case*
 > string within DESCRIPT.ION (it can read DESCRIPT.ION despite its being
 > a hidden file). The regular expression uses the "^" character to
 > indicate "search ONLY at the beginning of a line." If the errorlevel
 > returned is not 0, it means there is no file by the name "%@lower[%3]"
 > in DESCRIPT.ION. In that case, don't do anything further.
 >
 > If the description exists, then GREP returns errorlevel 0. In that
 > case, use SED to extract the comment out of DESCRIPT.ION, thus:
 >
 > 4) sed -n "/^%@lower[%3]/s/^[^ ]+ //p" descript.ion> temp.tmp
 >
 > This ugly little regular expression searches ONLY the line in question
 > within DESCRIPT.ION, and prints the line but *without* the file name
 > itself. That is, only that particular file comment is printed - and
 > redirected to file TEMP.TMP.

Mike:

You may be interested in the following, which does not use temporary files.

rem Put the filename in environment variable fname.
echo x|more|describe %[fname]|input %%fdesc
rem Input causes the cursor to advance, even if redirected, so return the
rem cursor to the next line.
echo [Alt-255]
set fdesc=%@substr[%[fdesc],%@eval[%@index[%[fdesc],:]+2],60]
rem %[fdesc] now has the file description!

Only problem is that input changes the cursor position even when redirected.

Yours from Oz.

Mitch.

