gpt4 book ai didi

regex - 匹配后如何停止grep

转载 作者:太空宇宙 更新时间:2023-11-04 09:11:58 24 4
gpt4 key购买 nike

在 Windows 中,我会使用 findsr 进行搜索以查找文件夹名称 同样,我想使用 grep

获取特定文件夹

在 Windows 中,我正在使用 svnlook tree -t [repos_path] | findstr (13\.9\.[0-9]+\/)

在 Ec2 Maiche (Linux) svnlook tree/var/www/svn/ILS | grep -Eo '(13\.9\.[0-9]+\/)'我得到了我需要的 repo 协议(protocol)

  • 13.9.4/
  • 13.9.5/
  • 13.9.6/
  • 13.9.7/

我的问题是 Linux 中的 grep 行不想停止(退出)它仍在运行。

enter image description here

匹配后如何停止?

最佳答案

您可以指定-m:最大计数。在指定数量的匹配行之后,grep 将停止。

关于regex - 匹配后如何停止grep,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54445802/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com