I want to read about one option in man page of gcc
. So i did man gcc | grep -- '^-c'
. The error was troff - cant break line
, because I have terminal on the half on my screen. But I fixed that with declaration of MANWIDTH=1000 man gcc | grep -- '^-c'
(thanks to: Why is this "can't break line" warning from grep of gcc man page?. But unfortunately it wont find it that option. Without the begginig pattern (that is only -c
: in full : MANWIDTH=1000 man gcc | grep -- '-c'
, It will find all the occurrence of -c
, which is quit a lot, but particularly the option I am looking for will be messed up with useless searches. So why does not the grep
uses ^
and $
as beginning and end of the line? Or does it have something to do with the size of my terminal window (that is, shorten by width) = the anchor of lines? And how can I then search with grep by beginning of lines without fullscreening the terminal?
PS:
I do not know why, when I declare the MANWIDTH var, it won't apply with man command immediately, despite it's value. That is, If i declare it first, and then try to man something (eventually pipe it to grep for lines search), The error arise again : troff: warning: can't break line
As this:
MANWIDTH=1000;
echo $MANWIDTH #output 1000
man gcc | grep -- '^-c'
troff: <standard input>:10635: warning [p 97, 19.0i]: can't break line