Subject: Re: add less in /rescue
To: Ian Zagorskih <ianzag@megasignal.com>
From: Greg A. Woods <woods@weird.com>
List: tech-userlevel
Date: 07/02/2004 15:07:24
[ On Friday, July 2, 2004 at 17:55:35 (+0700), Ian Zagorskih wrote: ]
> Subject: Re: add less in /rescue
>
> On Friday 02 July 2004 17:45, Berndt Josef Wulf wrote:
> >
> > You could save the output of dmesg into a file and use ed to inspect its
> > contents.
>
> Maybe i'm wrong but ed is a bit ascetic utility.. :)
"Ed" is in fact a very fine and _very_ useful utility, as ascetic as it
may be. I think learning to use "ed" well can still teach most people
more about Unix than any other single utility could ever do. Except
maybe sh. :-)
Having to use a temporary file, especially in this situation, is what's
no doubt most painful (maybe one might have to use mount_mfs in order to
even have a place to put such a file).
Of course if one had 'sed' one could easily use commands the likes of:
dmesg | sed -n -e 1,24p
dmesg | sed -n -e 25,50p
and so on to view portions of the output of something like "dmesg"
without using any temporary files.
Unfortunately 'sed' doesn't seem to be in /rescue, nor is 'awk' or
much of anything else which could easily do similar tricks....
Howerver there is still 'sh'! :-)
i=1
dmesg | while read line ; do
echo $line
if [ $((i++ % 24) -eq 0 ]; then
read ret < /dev/tty
fi
done
It doesn't handle counting of wrapped lines of course, but it's better
than trying to use <CTRL-S>! :-)
--
Greg A. Woods
+1 416 218-0098 VE3TCP RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com> Secrets of the Weird <woods@weird.com>