Man, this list rocks, and I am really atarting to love this language. Thanks
for all your suggestions. Ultimately, Paul is the winner :) The code follows
works wonders:

        #!/usr/bin/perl -w
        use strict;
        use CGI qw(:standard);

        print header(), start_html("Online Manpage Accessor"), h1("Online Manpage
Accessor");
        if (param()) {
                my $manpage = param("manpage");
                my @output = `man $manpage | perl -pe 's/(?:.\cH)//g'`; #Thanks Paul
                print "<pre>";
                foreach (@output) {$_ =~ /\w/; print };
                print "</pre>";
        } else {
                print hr, start_form;
                print p("Enter manpage: ", textfield("manpage"));
                print p(submit("lookup"), reset("clear"));
                print end_form, hr;
        }
        print end_html();


Thanks again,
Patrick


> --- Casey West <[EMAIL PROTECTED]> wrote:
> > On Wed, May 02, 2001 at 03:12:23PM -0500, J. Patrick Lanigan wrote:
> > : Thanks to Paul and Mike for the quick response.
> > :
> > : Now, does anyone know how I can trim out the unwanted charecters
> > from the
> > : output of a man page so that I can display it in a browser?
> >
> > Well, you could use the man2html utility, it doesn't seem like anyone
> > is interested in tackling the job of converting Man to 'X' on CPAN.
> > You might get away with stripping out just the text by doing:
> >
> >   man ls | perl -pe's#(.)(\cH\1)|_\cH(.)#$1||$3#ge'
>
> Couldn't you just delete all characters followed by a backspace?
>
>     man ls | perl -pe 's/(?:.\cH)//g'
>
> perl -p meaning print each line after processing it, -e meaning do this
> expression first; the pattern being "substitute any character followed
> by a backspace with nothing, globally".

Reply via email to