<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>生活周遭 &#187; grep</title>
	<atom:link href="http://blog.leirahua.com/tag/grep/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.leirahua.com</link>
	<description>In My Circle</description>
	<lastBuildDate>Wed, 27 Jan 2010 15:56:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Tips: grep, output only matched patterns</title>
		<link>http://blog.leirahua.com/2006/tips-grep-output-only-matched-patterns/</link>
		<comments>http://blog.leirahua.com/2006/tips-grep-output-only-matched-patterns/#comments</comments>
		<pubDate>Tue, 13 Jun 2006 05:09:22 +0000</pubDate>
		<dc:creator>leira</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[regexp]]></category>

		<guid isPermaLink="false">http://blog.leirahua.com/articles/tips-grep-output-only-matched-patterns.html</guid>
		<description><![CDATA[在&#8220;sed的in-place edit选项，和RTFM&#8221;中，说到过： &#8230;关于 Search and Replace 和 Regular Expression，还有一个问题困扰我，在这儿记下来。 就是将文件中符合某个pattern的字符串打印出来。注意，只是符合这个pattern的字符串本身，而不是所在行。直接一看，这怎么都是grep的工作嘛，可以在对grep狠狠的RTFM以后，还是未果&#8230; 在GNU grep&#39;s new features上看到 If you haven&#39;t been paying attention to GNU grep recently, you should be happily surprised by some of the new features and options that have come about with the 2.5 series. They bring it functionality you can&#39;t get anyWhere&#160;else &#8212; including [...]]]></description>
			<content:encoded><![CDATA[<hr/>在<a href="http://my.opera.com/Leira/blog/show.dml/174561" target="_blank">&#8220;sed的in-place edit选项，和RTFM&#8221;</a>中，说到过：<br/><br />
<blockquote class="bbquote">&#8230;关于 Search and Replace 和 Regular Expression，还有一个问题困扰我，在这儿记下来。 就是将文件中符合某个pattern的字符串打印出来。注意，只是符合这个pattern的字符串本身，而不是所在行。直接一看，这怎么都是grep的工作嘛，可以在对grep狠狠的RTFM以后，还是未果&#8230;</p></blockquote>
<p><br/>在<a href="http://www.linux.com/article.pl?sid=06/05/19/1920231" target="_blank">GNU grep&#39;s new features</a>上看到<br/><br />
<blockquote class="bbquote">If you haven&#39;t been paying attention to GNU grep recently, you should be happily surprised by some of the new features and options that have come about with the 2.5 series. They bring it functionality you can&#39;t get anyWhere&nbsp;else &#8212; including the ability to output only matched patterns (not lines), color output, and new file and directory options.</p></blockquote>
<p><br/>于是特地又看了一下grep的man page，我手边的是公司里cygwin下的grep-2.5.1a，果然有这么一个参数：<br/>
<pre>  -o, --only-matching       show only the part of a line matching PATTERN</pre>
<p><br/>试了一下，真是好用。看来是2.5系列新加的功能。（不过现在又不免想，是不是早在发<a href="http://my.opera.com/Leira/blog/show.dml/174561" target="_blank">sed的in-place edit选项，和RTFM</a>，grep就已经有-o可用了？汗~……）</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.leirahua.com/2006/tips-grep-output-only-matched-patterns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
