Why is this “can't break line” warning from grep of gcc man page?

爷,独闯天下 提交于 2020-01-21 05:09:43

问题


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.

回答1:


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$'


来源:https://stackoverflow.com/questions/34621046/why-is-this-cant-break-line-warning-from-grep-of-gcc-man-page

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!