<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Regular expressions and search patterns</title>
	<link>http://polishlinux.org</link>
	<description>All About GNU/Linux and BSD - reviews, comparisons, articles</description>
	<pubDate>Fri, 29 Aug 2008 06:22:53 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: lieven</title>
		<link>http://polishlinux.org/console/regular-expressions-and-search-patterns/#comment-59993</link>
		<dc:creator>lieven</dc:creator>
		<pubDate>Tue, 25 Sep 2007 11:47:44 +0000</pubDate>
		<guid>http://polishlinux.org/console/regular-expressions-and-search-patterns/#comment-59993</guid>
		<description>I think there's another typo:
Didn't you forget the backslash?


find . -size +110M -size -150M -exec cp {} /home/adam/files/ \;

This article is great. Maybe the best I've read on the
subject. Thanks...</description>
		<content:encoded><![CDATA[<p>I think there&#8217;s another typo:<br />
Didn&#8217;t you forget the backslash?</p>
<p>find . -size +110M -size -150M -exec cp {} /home/adam/files/ \;</p>
<p>This article is great. Maybe the best I&#8217;ve read on the<br />
subject. Thanks&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: LightningCrash</title>
		<link>http://polishlinux.org/console/regular-expressions-and-search-patterns/#comment-59984</link>
		<dc:creator>LightningCrash</dc:creator>
		<pubDate>Tue, 25 Sep 2007 11:02:35 +0000</pubDate>
		<guid>http://polishlinux.org/console/regular-expressions-and-search-patterns/#comment-59984</guid>
		<description>No mention of sed or perl?

Also, you don't have to pipe find to xargs for an rm. -delete works just as well.

Btw, ls and rm don't actually accept regexps. They will, however, accept globbing from bash, which is what your examples end up producing.

Regexps can also strip HTML from files, ie
cat file.html&#124;sed -e 's/]*&#62;//g' &#62;&#62; file.txt

You can also make find's -regex option case insensitive by making it -iregex. This is handy when you're searching through a mixed environment of upper case and lower case file extensions like jpg and JPG.

And don't forget, the rename command also accepts regexps!
For instance, if you want to change the case of some JPG files to lower case:

cd ~/photos/dirwithphotos
rename 's/JPG$/jpg/' *.JPG

Done.
You can go further with it, too. For instance, if I want to change the first part of the filename, since they’re all named IMG_0123.JPG

cd ~/photos/icanhaslinux
rename 's/^IMG/icanhaslinux/' *
rename 's/JPG$/jpg' *

It accepts very sed-like regexp behavior.

Anyway, that's all for now!
-LightningCrash</description>
		<content:encoded><![CDATA[<p>No mention of sed or perl?</p>
<p>Also, you don&#8217;t have to pipe find to xargs for an rm. -delete works just as well.</p>
<p>Btw, ls and rm don&#8217;t actually accept regexps. They will, however, accept globbing from bash, which is what your examples end up producing.</p>
<p>Regexps can also strip HTML from files, ie<br />
cat file.html|sed -e &#8217;s/]*&gt;//g&#8217; &gt;&gt; file.txt</p>
<p>You can also make find&#8217;s -regex option case insensitive by making it -iregex. This is handy when you&#8217;re searching through a mixed environment of upper case and lower case file extensions like jpg and JPG.</p>
<p>And don&#8217;t forget, the rename command also accepts regexps!<br />
For instance, if you want to change the case of some JPG files to lower case:</p>
<p>cd ~/photos/dirwithphotos<br />
rename &#8217;s/JPG$/jpg/&#8217; *.JPG</p>
<p>Done.<br />
You can go further with it, too. For instance, if I want to change the first part of the filename, since they’re all named IMG_0123.JPG</p>
<p>cd ~/photos/icanhaslinux<br />
rename &#8217;s/^IMG/icanhaslinux/&#8217; *<br />
rename &#8217;s/JPG$/jpg&#8217; *</p>
<p>It accepts very sed-like regexp behavior.</p>
<p>Anyway, that&#8217;s all for now!<br />
-LightningCrash</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alex</title>
		<link>http://polishlinux.org/console/regular-expressions-and-search-patterns/#comment-59572</link>
		<dc:creator>alex</dc:creator>
		<pubDate>Mon, 24 Sep 2007 13:17:16 +0000</pubDate>
		<guid>http://polishlinux.org/console/regular-expressions-and-search-patterns/#comment-59572</guid>
		<description>My current fav' is &lt;em&gt;locate&lt;/em&gt; which also has the regular expression option for the command line (-e without checking). I find it swifter and easier than find (which I find much more complex to use and as I don't often use it always have to look things up).</description>
		<content:encoded><![CDATA[<p>My current fav&#8217; is <em>locate</em> which also has the regular expression option for the command line (-e without checking). I find it swifter and easier than find (which I find much more complex to use and as I don&#8217;t often use it always have to look things up).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: michuk</title>
		<link>http://polishlinux.org/console/regular-expressions-and-search-patterns/#comment-59511</link>
		<dc:creator>michuk</dc:creator>
		<pubDate>Mon, 24 Sep 2007 09:54:32 +0000</pubDate>
		<guid>http://polishlinux.org/console/regular-expressions-and-search-patterns/#comment-59511</guid>
		<description>Thanks. Corrected!</description>
		<content:encoded><![CDATA[<p>Thanks. Corrected!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Geoff</title>
		<link>http://polishlinux.org/console/regular-expressions-and-search-patterns/#comment-59395</link>
		<dc:creator>Geoff</dc:creator>
		<pubDate>Mon, 24 Sep 2007 01:54:20 +0000</pubDate>
		<guid>http://polishlinux.org/console/regular-expressions-and-search-patterns/#comment-59395</guid>
		<description>An excellent article. Two typos, though: 'proceeding' is used twice, when 'preceding' is really meant. 'proceeding' would mean that the characters are underway, or going somewhere, which is not the intended sense.</description>
		<content:encoded><![CDATA[<p>An excellent article. Two typos, though: &#8216;proceeding&#8217; is used twice, when &#8216;preceding&#8217; is really meant. &#8216;proceeding&#8217; would mean that the characters are underway, or going somewhere, which is not the intended sense.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
