This ought to be easier, but under some versions of Win32 DOS, this snippet proves useful.

The scenario: You want to go ahead and upgrade those modules you've installed via Active State PPM, for which PPM finds newer versions available while searching using the 'ppm upgrade' command. On one of my systems, I have dozens of modules installed, and at any given time, six or seven of them may benefit from being updated. If I type ppm upgrade to find the list of modules that have upgrades, two things happen. First, a long list of every module I have installed via PPM gets spewed to the screen (most say XXX::YYYY: up to date, while some list upgrades available), and second, the list goes scrolling right off the screen.

The quickest solution would be ppm upgrade > upgrade.txt, to redirect the output. But alas, that simply doesn't work on some versions of MSDOS for Win32. Why? Who knows. At first I thought maybe the report was going to STDERR or something, but no, it just won't redirect. The output file is created, but it just remains empty.

What follows is a quick one-liner solution for people who want only the list of modules that do need updating, and need the list dumped to a file where they can read it without worrying about it scrolling into oblivion.

This one liner still uses redirection, but fortunately, this way it actually works, and has the added bonus of allowing Perl to toss out the unneeded list of modules that don't need updating.

perl -e "print qq/$_\n/ for grep( ! /up to date/, split( /\n/, `ppm up +grade` ) )" > update.txt

In reply to Redirect filtered PPM screen output to a file. by davido

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.