I'm trying to make a shell script that can change class names in source files.
The following will run without an error message but it doesn't do exactly what I want.
[code]sed 's/from/to/g' somefile_containing_from.txt[/code]
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".
Due to the problem in the above command, the following undesired replacements happen:
File contents for student.java before running through sed command:
public class student
private student topstudent;
[code]sed 's/student/Student/g' student.java[/code]
Prints the following:
public class Student
private Student topStudent;
Notice that the variable name changed because it found "student" in the output even though topstudent was not the class name.