This is a walkthrough one of the simple scripts mentioned in the earlier thread.
for file in *.html
do
cp $file $file.bak &&
sed 's/Copyright 1999-2005 - All rights reserved/Copyright 1999-2007 - All rights reserved/g' $file.bak >$file
done
EXPLANATION LINE BY LINE
**************************************************************************
for file in *.html <--- meaning repeat the following for every file with an html ending (is essentially a txt file ending with html)
do <--- Loop indication
cp $file $file.bak && <--- create backup of all files to a backup version called .bak AND (continues on next line)
sed 's/THE TEXT YOU WANT TO CHANGE/THE TEXT YOU WISH IT TO BE/g' $file.bak >$file <--- here you indicate what to change and what to change it into the / is the delimiter - it could be # if you had lines with slashes in it etc.
done <--- continue until all above has been executed
**************************************************************************
The bash script in the link I supplied you with earlier curtesy of jozybaof is searching for an exact substring and replaces it with another.
I would strongly suggest you read the discussion in the mentioned thread as I believe if you are indeed trying to change something in a text file you will have no trouble doing so by following the advice.
There is also a tutorial on SED at
http://sed.sourceforge.net/grabbag/tutorials/ - Even going as far as teaching you to use SED to solve the Towers of Hanoi.
Towers of Hanoi - From Wikipedia.org BEGIN QUOTE: "The Tower of Hanoi or Towers of Hanoi is a mathematical game or puzzle. It consists of three pegs, and a number of disks of different sizes which can slide onto any peg. The puzzle starts with the disks neatly stacked in order of size on one peg, the smallest at the top, thus making a conical shape.
The objective of the game is to move the entire stack to another peg, obeying the following rules: * Only one disk may be moved at a time. * Each move consists of taking the upper disk from one of the pegs and sliding it onto another peg, on top of the other disks that may already be present on that peg. * No disk may be placed on top of a smaller disk. END QUOTE
And if your mastery of SED comes as far as that level let me be the first to congratulate you!
Perhaps I have not quite understood your dilemma correctly - Hope this has been of assistance.