<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Regular expression, text replacement using simple edit' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Regular expression, text replacement using simple edit' posted on the 'LINUX programming' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 18 May 2013 21:52:25 -0700</pubDate>
    <lastBuildDate>Sat, 18 May 2013 21:52:25 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Regular expression, text replacement using simple edit</title>
      <link>http://www.programmersheaven.com/mb/Linux/412672/412672/regular-expression-text-replacement-using-simple-edit/</link>
      <description>I'm trying to make a shell script that can change class names in source files.&lt;br /&gt;
&lt;br /&gt;
The following will run without an error message but it doesn't do exactly what I want.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;sed 's/from/to/g' somefile_containing_from.txt&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
That command will replace all occurrences of the word "from" to "to" while printing out the contents of the file. What I need is something where it only matches when there is a non-letter before and after the "from". &lt;br /&gt;
&lt;br /&gt;
Due to the problem in the above command, the following undesired replacements happen:&lt;br /&gt;
&lt;br /&gt;
File contents for student.java before running through sed command:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
public class student
{
   private student[] topstudent;
}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
using command:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;sed 's/student/Student/g' student.java&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Prints the following:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
public class Student
{
   private Student[] topStudent;
}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the variable name changed because it found "student" in the output even though topstudent was not the class name.</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Linux/412672/412672/regular-expression-text-replacement-using-simple-edit/</guid>
      <pubDate>Sun, 31 Jan 2010 18:35:41 -0700</pubDate>
      <category>LINUX programming</category>
    </item>
  </channel>
</rss>