Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Parsing (l)unix man pages

by Cirollo (Friar)
on Aug 21, 2001 at 00:54 UTC ( #106364=note: print w/replies, xml ) Need Help??

in reply to Parsing (l)unix man pages

perl -e 'open(FILE, "/usr/bin/man ssh | "); while(<FILE>) { print if / +SYNOPSIS/ }'
Works great, on Solaris. Maybe the fancy formatting (bold fonts etc) of the man page on your system is what is getting you hung up? Having weird terminal control characters in the output from man to do font decorations might be making your match fail.

Replies are listed 'Best First'.
Re: Re: Parsing (l)unix man pages
by Cine (Friar) on Aug 21, 2001 at 00:57 UTC
    Man usually just prints the text when it sees that the output is not going to a terminal...

    T I M T O W T D I
      perl -e 'open(FILE, "/usr/bin/man ssh | "); while(<FILE>) { print if /SYNOPSIS/ }'
      (testing)%perl -e 'open(FILE, "/usr/bin/man ssh | "); while(<FILE>) { print if /SYNOPSIS/ }'
      well see that doesn't work for me... I'm using hyperterminal in winNT dunno if that is why or not. I just get no output from the above cmd.
        :(testing)%perl -e 'open(FILE, "/usr/bin/man ssh| ");while(<FILE>){pri +nt if /SYNOPSIS/ }' :(testing)%
        heh, didn't use code tags and it took out the <FILE> part but it still doesn't work.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://106364]
[karlgoethebier]: My perltidy adds a semicolon after .... How can i avoid this?
[LanX]: ellipse aka ... aka yadda yadda is a new command
[LanX]: sopw!

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2017-11-18 18:14 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (277 votes). Check out past polls.