http://qs321.pair.com?node_id=11120692


in reply to [OT] Filtering / Highlighting serial port input / PuTTY output

If you just need a resizeable terminal to run Perl in, you could always use Cygwin's mintty or ConEmu.
  • Comment on Re: [OT] Filtering / Highlighting serial port input / PuTTY output

Replies are listed 'Best First'.
Re^2: [OT] Filtering / Highlighting serial port input / PuTTY output
by afoken (Chancellor) on Aug 14, 2020 at 12:08 UTC
    If you just need a resizeable terminal to run Perl in, you could always use Cygwin's mintty or ConEmu.

    ConEmu did the trick, combined with pryrt++'s plink idea. It took a little configuration to make it look like a boring console window again, mainly invoking cmd.exe without parameters, using the default windows color scheme, and hiding the status bar and the tab bar.

    Thank you!

    And now that perl is involved, and ConEmu supports ANSI, I already consider using ANSI sequences to highlight matching lines instead of filtering out all irrelevant lines ...

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      Getting rid of unwanted lines:

      plink -serial COM24 -sercfg 115200,8,n,1,N | perl -ne "/^(Pct|NRS)/ && + print"

      Highlighting interesting lines instead:

      plink -serial COM24 -sercfg 115200,8,n,1,N | perl -MTerm::ANSIColor -n +e "print colored($_, /^(Pct|NRS)/ ? 'bright_yellow' : 'white')"

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)