zoukankan      html  css  js  c++  java
  • How to only capute sub-matched character by grep

    File content:

    <a href="ceph-0.80.9-82.1.x86_64.rpm"><img src="/icons/rpm.gif" alt="[   ]" width="16" height="16" /></a> <a href="ceph-0.80.9-82.1.x86_64.rpm">ceph-0.80.9-82.1.x86_64.rpm</a>                                     11-Jun-2015 16:37  9.9M   <a href="ceph-0.80.9-82.1.x86_64.rpm.mirrorlist">Details</a>
    <a href="ceph-common-0.80.9-82.1.x86_64.rpm"><img src="/icons/rpm.gif" alt="[   ]" width="16" height="16" /></a> <a href="ceph-common-0.80.9-82.1.x86_64.rpm">ceph-common-0.80.9-82.1.x86_64.rpm</a>                              11-Jun-2015 16:37  3.9M   <a href="ceph-common-0.80.9-82.1.x86_64.rpm.mirrorlist">Details</a>
    <a href="ceph-common-debuginfo-0.80.9-82.1.x86_64.rpm"><img src="/icons/rpm.gif" alt="[   ]" width="16" height="16" /></a> <a href="ceph-common-debuginfo-0.80.9-82.1.x86_64.rpm">ceph-common-debuginfo-0.80.9-82.1.x86_64.rpm</a>                    11-Jun-2015 16:37   49M   <a href="ceph-common-debuginfo-0.80.9-82.1.x86_64.rpm.mirrorlist">Details</a>

    ......

    Command:

    grep -P -o ">K[^ ]+?x86_64.rpm" <file name>

    -P : perl format regular expression

    -o : only matched content

    K : throw away content of before K

    Result:

    xen-doc-html-4.4.2_06-3.1.x86_64.rpm
    xen-kmp-default-4.4.2_06_k3.12.28_4-3.1.x86_64.rpm
    xen-kmp-default-debuginfo-4.4.2_06_k3.12.28_4-3.1.x86_64.rpm
    xen-libs-4.4.2_06-3.1.x86_64.rpm
    xen-libs-debuginfo-4.4.2_06-3.1.x86_64.rpm
    xen-tools-4.4.2_06-3.1.x86_64.rpm
    xen-tools-debuginfo-4.4.2_06-3.1.x86_64.rpm
    xen-tools-domU-4.4.2_06-3.1.x86_64.rpm

  • 相关阅读:
    css position 和 块级/行内元素解释
    jquery.cookie.js $.cookie()是怎么使用
    css transition transform animation例子讲解
    HttpUrlConnection使用详解--转
    HttpURLConnection与HttpClient浅析---转
    java对含有中文的字符串进行Unicode编码
    VMWARE里安装时出现'SMBus Host Controller not enabled'
    消息队列 Kafka 的基本知识及 .NET Core 客户端
    安装和测试Kafka
    mongo 聚合函数
  • 原文地址:https://www.cnblogs.com/root-wang/p/4578749.html
Copyright © 2011-2022 走看看