博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
How to only capute sub-matched character by grep
阅读量:4614 次
发布时间:2019-06-09

本文共 1445 字,大约阅读时间需要 4 分钟。

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

转载于:https://www.cnblogs.com/root-wang/p/4578749.html

你可能感兴趣的文章
[Vue-rx] Stream an API using RxJS into a Vue.js Template
查看>>
解决VC几个编译问题的方法——好用
查看>>
SPOJ #11 Factorial
查看>>
City Upgrades
查看>>
“人少也能办大事”---K2 BPM老客户交流会
查看>>
关于七牛进行图片添加文字水印操作小计
查看>>
DataSource数据库的使用
查看>>
CentOS开启samba实现文件共享
查看>>
MSSQL使用sqlbulkcopy批量插入数据
查看>>
证明一个数能被3整除,当且仅当它的各位数的和能被3整除
查看>>
2018秋寒假作业4—PTA编程总结1
查看>>
android自适应屏幕
查看>>
2019-北航面向对象-电梯作业总结
查看>>
SqlHelper
查看>>
初识算法、数据结构
查看>>
Luogu4069 SDOI2016 游戏 树链剖分、李超线段树
查看>>
Java的内部类真的那么难以理解?
查看>>
一文搞懂Java环境,轻松实现Hello World!
查看>>
hash实现锚点平滑滚动定位
查看>>
也谈智能手机游戏开发中的分辨率自适应问题
查看>>