如何截断grep或ack返回的长匹配行

我想在通常有很长行的HTML文件上运行ack或grep.我不希望看到很长的线条反复包裹.但我确实希望看到围绕与正则表达式匹配的字符串的长行的那一部分.如何使用任何Unix工具组合获得此功能
您可以使用grep选项-o,可能结合将模式更改为“.{0,10}< original pattern>.{0,10}”以查看其周围的某些上下文:
       -o,--only-matching
              Show only the part of a matching line that matches PATTERN.

..或-c:

       -c,--count
              Suppress normal output; instead print a count of matching  lines
              for  each  input  file.  With the -v,--invert-match option (see
              below),count non-matching lines.

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...