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
How to only capute sub-matched character by grep的更多相关文章
- strtok strchr strrchr strchrnul
NAME strchr, strrchr, strchrnul - locate character in string SYNOPSIS #include <strin ...
- 常用算法3 - 字符串查找/模式匹配算法(BF & KMP算法)
相信我们都有在linux下查找文本内容的经历,比如当我们使用vim查找文本文件中的某个字或者某段话时,Linux很快做出反应并给出相应结果,特别方便快捷! 那么,我们有木有想过linux是如何在浩如烟 ...
- 归纳整理Linux下C语言常用的库函数----内存及字符串控制及操作
在没有IDE的时候,记住一些常用的库函数的函数名.参数.基本用法及注意事项是很有必要的. 参照Linux_C_HS.chm的目录,我大致将常用的函数分为一下几类: 1. 内存及字符串控制及操作 2. ...
- js css 实现简单的计算器
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- CharUtil
package com.opslab.util; import java.io.UnsupportedEncodingException; /** * Various character and ch ...
- man bash
BASH(1) General Commands Manual BASH(1) NAME bash - GNU Bourne-Again SHell SYNOPSIS bash [options] [ ...
- R语言函数化学习笔记6
R语言函数化学习笔记 1.apply函数 可以让list或者vector的元素依次执行一遍调用的函数,输出的结果是list格式 2.sapply函数 原理和list一样,但是输出的结果是一个向量的形式 ...
- Dive into re Module in Python
Dive into RE in Python Standard re module in python is powerful to handle text manipulation,such as ...
- bash5.0参考手册
Bash Reference Manual a.summary-letter { text-decoration: none } blockquote.indentedblock { margin-r ...
随机推荐
- 网页设计之jQuery
1.在html中引入css和jQuery <!DOCTYPE html> <html lang="en"> <head> <meta ch ...
- python第14天
Python之前端web: HTML CSS 一. 什么是HTML: html为超文本语言,使用标签来描述网页. html标签格式: HTML 标签是由尖括号包围的关键词,比如 <html> ...
- go:匿名函数与闭包
一.匿名函数 定义:没有函数名的函数. 作用:在go语言中目前了解的作用就是用于构成闭包. *注:由于javascript不存在块级作用域,故匿名函数常用来包含代码以不污染全局命名空间,运行后销毁环境 ...
- js对文本框特殊字符串过滤
HTML 中 onkeyup="stripscript(this)"; function stripscript(obj) { var s = $(obj).val(); var ...
- xcode8 info.plist文件中的各种权限。
NSContactsUsageDescription -> 通讯录 NSMicrophoneUsageDescription -> 麦克风 NSPhotoLibraryUsageDescr ...
- java面试题及答案(转载)
JAVA相关基础知识1.面向对象的特征有哪些方面 1.抽象:抽象就是忽略一个主题中与当前目标无关的那些方面,以便更充分地注意与当前目标有关的方面.抽象并不打算了解全部问题,而只是选择其中的一部分,暂时 ...
- 使用 CUDA范例精解通用GPU编程 配套程序的方法
用vs新建一个cuda的项目,然后将系统自动生成的那个.cu里头的内容,除了头文件引用外,全部替代成先有代码的内容. 然后程序就能跑了. 因为新建的是cuda的项目,所以所有的头文件和库的引用系统都会 ...
- C#反射机制 Type类型
using System;using System.Collections.Generic;using System.Linq;using System.Reflection;using System ...
- LeetCode之237. Delete Node in a Linked List
------------------------------------------------ 因为不知道前序是谁,所以只好采用类似于数组实现的列表移动值, 又因为如果当前是最后一个元素了但是已经没 ...
- 浅析session&cookie
session&cookie没有出现的黑暗时代 大家都知道,HTTP协议是一种无状态的协议,本次请求下一次请求没有任何的关联,所有没有办法直接用http协议来记住用户的信息,试想一向,每一次点 ...