substitute strings in text files (links in html files)

1999-01-15 Thread Oliver Thuns
Hello!

How could I substitute a string (links) in html files with standard
Linux (debian) tools?

i.e. I want to change every http://one.domain.com in
http://two.domain.com in some files and files in subdirs.

Oliver


Re: substitute strings in text files (links in html files)

1999-01-15 Thread M.C. Vernon
On Fri, 15 Jan 1999, Oliver Thuns wrote:

 Hello!
 
 How could I substitute a string (links) in html files with standard
 Linux (debian) tools?

use sed. It is very powerful for this sort of thing.
 
Matthew

-- 
Elen sila lumenn' omentielvo

Steward of the Cambridge Tolkien Society
Selwyn College Computer Support
http://www.geocities.com/Area51/Chamber/8841/
http://www.cam.ac.uk/CambUniv/Societies/tolkien/
http://pick.sel.cam.ac.uk/


Re: substitute strings in text files (links in html files)

1999-01-15 Thread Eric Gillespie, Jr.
On Fri, 15 Jan 1999, Oliver Thuns wrote:

 Hello!
 
 How could I substitute a string (links) in html files with standard
 Linux (debian) tools?
 
 i.e. I want to change every http://one.domain.com in
 http://two.domain.com in some files and files in subdirs.
 

sed -e s/two/one/g f1.html f2.html

Don't redirect to your input file! You will lose it. If you need it to be
the same name, just rename afterwards. The s/two/one/g substitutes two
for one globally. Read sed's man page for more info.

 Oliver
 
 
 -- 
 Unsubscribe?  mail -s unsubscribe [EMAIL PROTECTED]  /dev/null
 

/--\
| pretzelgod | [EMAIL PROTECTED]   |
| (Eric Gillespie, Jr.)  | [EMAIL PROTECTED]|
|---*|
| That's the problem with going from a soldier to a   |
|  politician: you actually have to sit down and listen to |
|  people who six months ago you would've just shot.  |
|  --President John Sheridan, Babylon 5|
\--/


Re: substitute strings in text files (links in html files)

1999-01-15 Thread Andrew Ivanov
 Hello!
 
 How could I substitute a string (links) in html files with standard
 Linux (debian) tools?
 
 i.e. I want to change every http://one.domain.com in
 http://two.domain.com in some files and files in subdirs.

sed -e s/one.domain.com/two.domain.com/ originalfile  newfile

Andrew

Never include a comment that will help | Andrew Ivanov
someone else understand your code. | [EMAIL PROTECTED]
If they understand it, they don't  | ICQ: 12402354
need you.  |


Re: substitute strings in text files (links in html files)

1999-01-15 Thread kaynjay
In [EMAIL PROTECTED], on 01/15/99 
   at 12:39 PM, Oliver Thuns [EMAIL PROTECTED] said:

Hello!

How could I substitute a string (links) in html files with standard Linux
(debian) tools?

i.e. I want to change every http://one.domain.com in
http://two.domain.com in some files and files in subdirs.

In using sed to do this, you may want to expand the string being sought by
sed so that you don't inadvertently change other instances of one to
two.

If you do want to search for http://one.domain; and change it to
http://two.domain; then you need to escape the slashes, since they also
serve as control characters for sed. (The colon may too.  I don't recall
offhand, as my experience is limited.)  

This would be done as follows:
  sed s/http:\/\/one.domain/http:\/\/two.domain/g  file  file1 The \ in
front of each / tells sed to treat the / as a regular character, instead
of a control character.

Kenward
-- 
---
[EMAIL PROTECTED]

What do you call a bus of lawyers headed over a cliff, with two empty seats?
   A waste of space.
---