Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

grep

gcc

manpage

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.
like image 625
wlnirvana Avatar asked Jan 05 '16 20:01

wlnirvana


1 Answers

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$'
like image 80
poke53280 Avatar answered Nov 05 '22 02:11

poke53280