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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |