What Eric says is true, but some examples of my first thoughts are that in Linux gzip produces files with a .gz extension (so LOG.gz ?) and my approach would be to get the file structure into j and then use a host function to execute zegrep of the phrase in the Linux environment (it is this kind of thing that I don't know how to do in Windows since jdict tells me that 2!:0-3 is not available in Windows...). Using that approach would avoid explicit unzip of the files, and would result in an array with the complete lines containing your key information. Then you could apply a little j to pick out the bit between the starting string and the terminating string.
- joey On 2011/11/03 18:37 , Skip Cave wrote: > I was assuming I would do the job in J, but a comparison between the J > approach and a shell script or other scheme, would be enlightening. My > files and the 6.02 J interpreter are on a Win7 64-bit machine with 4 gig of > ram. > > Skip > > On Thu, Nov 3, 2011 at 8:05 PM, Eric Iverson<[email protected]>wrote: > >> If done in J it would be done essentially identically on all platforms. The >> only little bit of host dependency would be calling unzip and I'm sure >> forum members could help make that easy. >> >> On Thu, Nov 3, 2011 at 9:01 PM, Joey K Tuttle<[email protected]> wrote: >> >>> On 2011/11/03 17:50 , Skip Cave wrote: >>>> I have several thousand files which are distributed into about a >> thousand >>>> folders. All of the folders are contained in one directory on my >> machine. >>>> Each of the thousand folders contains 1-10 files. All of the files in >>> each >>>> folder have been compressed using the gzip program. I need to sequence >>>> through all of the folders, find the file in each folder labeled "LOG" >>>> (there will be only one in each folder, with no extension), and expand >>> it. >>>> I then need to examine the expanded LOG file (ASCII text file) and >> search >>>> the LOG file for a specific unique text string that will be the same in >>> all >>>> the LOG files. I need to extract the string of a few hundred characters >>>> that *follows* the initial matched string in the LOG file. That second >>>> string will be terminated by another (different& third) unique text >>> string >>>> which will also be the same in all LOG files. I want to place all of >> the >>>> extracted strings into a single boxed array using a single J function. >>>> >>>> How hard is it to do this in J? Can someone give me a start in the >> right >>>> direction, perhaps with some example code? I currently only have J 6.02 >>> on >>>> my machine. >>>> >>> What environment? If Linux or OSX, it's my kind of thing (seems quite >>> reasonable, and I could have a go at providing example code) - but I >>> have no knowledge of how to approach it in Windows.... >>> >>> - joey >>> >>> >>> ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
