In any case, now I have a way to unzip files. The next step is to get the
compressed file, expand it, then use Ric Sherlock's getTagContents verb to
extract the strings I want. Here's the code to do all that:
aa =: > ('starttag;'endtag') getTagContents shell zipth, filepth
aa
This is the first string I want
This is the second string I want
Ric's getTagContents verb worked great! There are only 2 problems with the
output. The first problem in the output is that there is a line feed at the
end of the first string that gets captured in the string. I found that the
invisible characters at the end of the lines were ASCII codes 13, 10, and
9, in that order. So I created a string for that match:
crlf =: 13 10 9 { a.
So to get rid of those characters in the output I tried including those
characters in the endtag string:
> ('starttag;'crlf,'endtag') getTagContents shell zipth, filepth
That worked! So now I have:
This is the first string I want
This is the second string I want
The second problem is that the first captured string has a variable number
of spaces preceding it which I need to remove. I want to always remove
consecutive spaces in all of the output, leaving only single consecutive
spaces in the result string. However, I also want to remove the leading
space on any string. So now I am off looking at ways to build a space
remover verb.
Skip
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm