Loading ...
Sorry, an error occurred while loading the content.

550Re: Redirecting GAWK Output

Expand Messages
  • mycroftj
    May 12 2:08 PM
    • 0 Attachment
      I am going to be teaching myself GAWK as soon as I have some time and this is a question I'm sure I will want the answer to.

      I know very little so far but have some quick ideas that might lead you somewhere.

      The first was selecting ALL and saving it. Then run the GAWK code and scoop up the results like you did then paste it all back. Not much better than what you did.

      Um, is it possible to add a line to your GAWK subroutine like PRINT $0 so all the lines are put back automatically? Then retrieve your answer from the end of the document and remove it.

      Then I was thinking of using ^$GetDosOutput$ or one of those similar commands. Honestly, I'm not clear on what ^$GetInputOutput$ or ^$GetOutput$ do. I wish there were some examples in the help. Perhaps creating a subroutine to output the desired text (input data) to a saved file and running GAWK in DOS passing the file to it. I suppose the code would have to be saved in a file and passed also. But then the output may be obtained using ^$GetDosOutput$. It would be easier after the subroutines that do most of the work are created.

      I do want to start messing with this and will let you know if I figure something better out. Please do the same!

      Thank you

      Joy


      --- In ntb-scripts@yahoogroups.com, "flo.gehrke" <flo.gehrke@...> wrote:
      >
      > Hi GAWK experts!
      >
      > I can clearly see how to run a GAWK script from a NT clip. But I get into trouble whith redirecting GAWK output to a clip. Example:
      >
      > Given some lines...
      >
      > Adelaide
      > Adria
      > Karkonjafarabadi
      > Karolyne
      > Rob
      >
      > I try to find out the size of the longest name. The GAWK script...
      >
      > # Find size of longest line
      > { if (length($0) > max) max = length($0) }
      > END { print max }
      >
      > will perfectly output '16' as the size of the third name but it replaces the whole list with '16'.
      >
      > So far, my work-around for that has been this...
      >
      > ; Copy whole list to a new document
      > ^!Toolbar Copy All
      > ^!Toolbar Paste New
      > ; Run GAWK script "Longest" (subclip in same library)
      > ^!RunGawk Longest
      > ; Copy result to clipboard
      > ^!SetClipboard ^$GetText$
      > ; Close second document
      > ^!Close Discard
      > ; Display result in infobox
      > ^!Info The longest name has ^$GetClipboard$ characters
      >
      > Could anyone explain to me please if there's a shorter way to redirect the GAWK result to the clip without overwriting the list?
      >
      > In my naive view, there should be a solution that redirects the GAWK result directly to the clipboard or a variable so the clip could call the result from there.
      >
      > Thanks for advice!
      >
      > Flo
      >
    • Show all 16 messages in this topic