[sword-devel] Automated Shell Script

Jeremy Pointer sword-devel@crosswire.org
Thu, 16 Nov 2000 13:00:16 +0200


On Thu 16 Nov 00 11:17, you wrote:
try :
 for i in test1.txt test2.txt ; \
 do sed 's/woohoo/boohoo/g' "$i" > temp.sed ;\
 mv -f temp.sed "$i" ; done 

or with wildcards
 for i in test*.txt  ; \
 do sed 's/woohoo/boohoo/g' "$i" > temp.sed ;\
 mv -f temp.sed "$i" ; done 

Type exactly as given including the back slashes and quote signs.
the logic is : For each file do sed replacing all woohoo's with boohoo's 
writing the output to a tempory file, then rename that file to the original 
source file.

> > Hey Everyone,
>
>        I have a question for the Linux guys on this list. I am trying to
> find a way to easily change the same string of text in a number of
> different files. This is for the Sword Copyright Website, I have about 7 or
> so HTML files in a directory on my computer that runs Linux, I would like
> to be able to execute a shell script or whatever works so I can change a
> string of text in each file. Just for an example so you really know what I
> mean:
>
> I want to change 'the sun is green' which is a string of text in all 8
> files, to 'the sun is yellow'. How do I do this easily and automated?
>
> Thanks for your time and keep the feedback about the site coming!
>
> -Jonathan
> BJW7TOAEM@aol.com

----------------------------------------
Content-Type: text/html; charset="US-ASCII"; name="Attachment: 1"
Content-Transfer-Encoding: 7bit
Content-Description: 
----------------------------------------