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

546Redirecting GAWK Output

Expand Messages
  • flo.gehrke
    May 10, 2012
    • 0 Attachment
      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...


      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!

    • Show all 16 messages in this topic