![]() |
|
FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below. |
![]() |
|
Thread Tools | Display Modes |
|
|||
![]()
Hello,
How do I pipe a man page into emacs for searching, or how do I make grep mimic an html anchor? |
|
|||
![]() Quote:
Code:
/usr/ports/sysutils/lookat Code:
alias man='env PAGER=lookat man $1'
__________________
FreeBSD 13-STABLE Last edited by jb_daefo; 24th October 2011 at 03:31 AM. Reason: Forgot the howto |
|
||||
![]()
To expand on the previous answers:
From man(1) Code:
-P pager Use specified pager. Defaults to “less -sR” if color support is enabled, or “more -s”. Overrides the MANPAGER environment vari‐ able, which in turn overrides the PAGER environment variable. % man cat | less is exactly the same as just using % man cat .As for searching, you can either use the / key in less, or use % man ls | egrep pattern Both methods support regular expressions are are basically the same, the (e)grep method is more suited for commandline/scripted use, while the interactive search in less is for interactive use.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. Last edited by Carpetsmoker; 24th October 2011 at 09:44 AM. |
|
||||
![]() Quote:
% man cat | less piples man pages for command cat into less thereby allowing regular expression search vi style. % man less Just gives me man pages for command less. You seem to claim that those two are the same. Could you please explain? |
|
|||
![]()
[FWIW I edited my post above to explain precisely how, it was less than useful originally as written.] Sorry for the oversight.
__________________
FreeBSD 13-STABLE |
|
||||
![]() Quote:
Using % man cat | less is exactly the same as just using % man cat .
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. |
|
||||
![]() Quote:
(it seems that I can input search word but it doesn't get highlighted) With % man cat|less it does get highlighted. I just checked this on Devio server as I am typing this message from a Windows machine. Actually OpenBSD man command doesn't have switch -P but the pager is on by default. Maybe I am missing something about highlighting in OpenBSD. |
|
||||
![]()
My word you're all useless lol (no offense), I'm a VIM user and I know this.
If you want to read a manual page in emacs, use M-x man and it will prompt you for the name of the man page. It will then open a window with the manual page all nicely formatted for you. If you use emacs a lot, avoid leaving it for crap like manual pages. If you really want to pipe it *into* emacs without running it through emacs, you will need an external program to simulate the effect of `man ls > tmp-file && emacs tmp-file && rm tmp-file`, because emacs is not really a UNIX program and like the original vi, not entirely friendly to being piped a file on stdin. You can find solutions on emacs wiki or Google. less generally presents a vi style interface for navigation, or at least it responds to my muscle memory. So if someone is asking to use emacs, probably not going to want /wtf searches. Sometimes I even use vim just for a better known target. I don't know how man -P emacs works on OpenBSD but my Linux work station doesn't work with it either.
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
|||
![]()
Work and things kept me away, but thanks for the replies.
|
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Pipe grep to copy files based on name. | Daffy | Programming | 5 | 28th May 2011 11:03 PM |
Improve searches | maxrussell | Feedback and Suggestions | 3 | 19th June 2009 09:45 AM |
Emacs nox11 | unixbsd | FreeBSD Ports and Packages | 2 | 18th March 2009 02:17 PM |
First time page / Start page | bichumo | General software and network | 7 | 27th October 2008 10:40 PM |
Emacs without X? | clevershark | FreeBSD Ports and Packages | 3 | 21st May 2008 05:02 PM |