you need:
   shell &.> zipth&, &.> lp

Just for clarity the definition of ( each ) is ( &.> ) (defined in
stdlib.ijs at boot of J session)


On Thu, Nov 10, 2011 at 12:03 PM, Skip Cave <s...@caveconsulting.com> wrote:
> David M suggested:
>
>   # shell&.> zipth, each lp
> |length error
> |   #shell&.>zipth    ,each lp
>
> That didn't work..
>
>   #lp
> 10
>   lp
> c:\test4\00-00-36-vx1prn123-7b42060a_00000d48_4eab4224_0060_0000/log.gz
> c:\test4\00-02-36-vx1prn123-7b42060a_00000d48_4eab429c_0061_0000/log.gz
> c:\test4\00-02-45-vx1prn123-7b42060a_00000d48_4eab42a5_0062_0000/log.gz
> c:\test4\00-05-24-vx1prn123-7b42060a_00000d48_4eab4344_0063_0000/log.gz
> c:\test4\00-08-24-vx1prn123-7b42060a_00000d48_4eab43f8_0064_0000/log.gz
> c:\test4\00-09-39-vx1prn123-7b42060a_00000d48_4eab4443_0065_0000/log.gz
> c:\test4\00-36-16-vx1prn123-7b42060a_00001cd4_4eab4a7f_0001_0000/log.gz
> c:\test4\00-36-31-vx1prn123-7b42060a_00001cd4_4eab4a8f_0002_0002/log.gz
> c:\test4\00-39-28-vx1prn123-7b42060a_00001cd4_4eab4b40_0003_0000/log.gz
> c:\test4\00-40-53-vx1prn123-7b42060a_00001cd4_4eab4b95_0004_0002/log.gz
>
> On Wed, Nov 9, 2011 at 4:57 PM, David Mitchell <davidmitch...@att.net>wrote:
>
>> One way would be to try this:
>>
>> shell&.> zipth, each lp
>> --
>> David Mitchell
>>
>> On 11/9/2011 17:37, Skip Cave wrote:
>> > OK, I have figured out how to get a list of each of the paths to each of
>> > the log.gz files in my directory tree.
>> >
>> >     lp =: (>  1 }. 1 dirpath 'c:\test4') ,"1 '/log.gz'
>> >     lp
>> > c:\test4\00-00-36-vx1prn123-7b42060a_00000d48_4eab4224_0060_0000/log.gz
>> > c:\test4\00-02-36-vx1prn123-7b42060a_00000d48_4eab429c_0061_0000/log.gz
>> > c:\test4\00-02-45-vx1prn123-7b42060a_00000d48_4eab42a5_0062_0000/log.gz
>> > c:\test4\00-05-24-vx1prn123-7b42060a_00000d48_4eab4344_0063_0000/log.gz
>> > c:\test4\00-08-24-vx1prn123-7b42060a_00000d48_4eab43f8_0064_0000/log.gz
>> > c:\test4\00-09-39-vx1prn123-7b42060a_00000d48_4eab4443_0065_0000/log.gz
>> > c:\test4\00-36-16-vx1prn123-7b42060a_00001cd4_4eab4a7f_0001_0000/log.gz
>> > c:\test4\00-36-31-vx1prn123-7b42060a_00001cd4_4eab4a8f_0002_0002/log.gz
>> > c:\test4\00-39-28-vx1prn123-7b42060a_00001cd4_4eab4b40_0003_0000/log.gz
>> > c:\test4\00-40-53-vx1prn123-7b42060a_00001cd4_4eab4b95_0004_0002/log.gz
>> >
>> > I know this is a bit of a brute force approach, but it ets the job done.
>> > Since I know that there is one log.gz file in each subdirectory, I can
>> > append the '/log.gz' string on the end of each directory path, to
>> complete
>> > the full path. I assume that there is some 'findfiles' utility that can
>> do
>> > the same job more elegantly without jamming strings together, but I
>> haven't
>> > found it as yet.
>> >
>> > Now that I have the list of file paths, I need to open each file and
>> > operate on it.
>> >
>> > I have predefined two path nouns:
>> >
>> >     zipth
>> > "c:\Gzip\gzip.exe -d -c"
>> >     filepth
>> > c:\test3\log.gz
>> >
>> > So, I can pull out a file and unzip it, given the file path:
>> >
>> >   $  shell zipth, filepth
>> > 237567
>> >
>> > But that is just one log.gz file unzipped into a text array. Now I need
>> to
>> > iterate through all of the list of log file paths I extracted above, and
>> > create an array of boxed text strings, one boxed string per expanded
>> log.gz
>> > file. "lp" contains the list of files, one path per row.
>> >
>> >   $  shell zipth, lp
>> > |rank error: uucp
>> > |   r=.CreateProcessF 0;(    uucp y);0;0;inh;f;0;0;si;pi
>> >
>> > That won't work.
>> >
>> >   $  shell zipth, each lp
>> > |length error
>> > |   $shell zipth    ,each lp
>> >
>> > Nope.
>> >
>> > How can you make the shell command iterate through the list of files, to
>> > unzip each log.gz file and put each unzipped text string in a new boxed
>> > array?
>> >
>> > Skip
>> > ----------------------------------------------------------------------
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>> >
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
>
> --
> Skip Cave
> Cave Consulting LLC
> Phone: 214-460-4861
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to