为什么这是“不能打破界限"?来自gcc手册页grep的警告? [英] Why is this "can't break line" warning from grep of gcc man page?

查看:118
本文介绍了为什么这是“不能打破界限"?来自gcc手册页grep的警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下命令查找以-s结尾的行,但收到​​警告:

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

下面是我的开发环境:

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

推荐答案

通常man格式化内容以匹配终端的宽度.您将其输出重定向到没有屏幕宽度"的管道,因此它使用默认的80字符宽度进行格式化. 某些手册页的表宽度超过80个字符,因此您会收到此无法中断行"警告. 试试这个:

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

这篇关于为什么这是“不能打破界限"?来自gcc手册页grep的警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆