7

I was trying to find a line ending with -s with the following command but got warnings:

$ man gcc | grep '\-s$'
<standard input>:4808: warning [p 54, 13.2i]: can't break line
$ man gcc | egrep '\-s$'
<standard input>:4808: warning [p 54, 13.2i]: can't break line

Below is my development environment:

$ uname -a
Linux localhost 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u1 (2015-12-14) x86_64 GNU/Linux

$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
wlnirvana
  • 1,811
  • 20
  • 36

1 Answers1

9

Normally man formats the content to match the width of the terminal. You redirect it's output to a pipe, which has no "screen width", therefore it formats using the default width of 80 chars. Some man pages has tables that are more than 80 chars wide, so you get this "can't break line" warning. Try this:

$ MANWIDTH=160 man gcc | grep '\-s$'
poke53280
  • 456
  • 5
  • 5
  • Somehow the issue cannot be reproduced on my current debian 9.5 with gcc 6.3. But I was able to get the error by `MANWIDTH=10 man gcc | grep '\-s$'`, so I guess your solution indeed will work. Thanks for the answer! – wlnirvana Jul 23 '18 at 02:54