On Thu, Nov 10, 2011 at 7:17 AM, Skip Cave <s...@caveconsulting.com> wrote: > OK, Now I am working on real data. > > This works: > > getSkipsTags =: ('RESULT[0]';crlf,'CONFIDENCE' > )& getTagContents > > getSkipsTags shell zipth, filepth > = u s air one ninety one > = yes > > So, I have captured the strings I want from the log.gz file. If I put the > result in a noun like this: > > bb =: > getSkipsTags shell zipth, filepth > > Now I can operate on the noun to replace the equals sign with a blank, and > then remove all the spaces by this: > > deb "1 bb rplc"1 '= ' > u s air one ninety one > yes
Kip has sorted your initial problem. I just have a couple of comments on the code. Firstly I'd be hesitant to include the CR,LF,TAB as part of the endtag unless the file format is really specified like that. For single character substitutions I think that charsub (also in the strings script) is more performant. Here are the in-script docs for it: NB. ========================================================= NB.*charsub v character substitution NB. characterpairs charsub string NB. For example: NB. '-_$ ' charsub '$123 -456 -789' NB. 123 _456 _789 NB. Use <rplc> for arbitrary string replacement. NB. NB. thanks to Dan Bron/Jforum 25 April 2006 Lastly when dealing with lists (e.g. strings) of different lengths I usually use boxing to prevent the issues you have discussed around J adding padding to regularize the array. bb =: getSkipsTags shell zipth, filepth deb each '= ' charsub each bb or cc=: ([: deb '= '&charsub) each bb If you need to write the strings out at some stage (without extra padding), you can use something like: 'mystrings.txt' fwrites~ ; ,&LF each cc ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm