LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-11-2005, 12:58 AM   #1
devilkin
Member
 
Registered: Jan 2005
Location: Australia
Distribution: LFS 6.0 #15056
Posts: 50

Rep: Reputation: 15
Batch search and replace


Someone has given me a website that has a large amount of absolute links on it (200+ pages) and I'm looking for a way to do a search and replace on all files to replace these absolute links with relative ones...

Can anyone suggest a start point for me? I do know a little bash scripting and a little C++ but i haven't the slightest idea where to start...
 
Old 02-11-2005, 09:28 AM   #2
Padma
Member
 
Registered: Aug 2003
Location: Omaha, NE, USA
Distribution: PCLinuxOS 2007
Posts: 808

Rep: Reputation: 30
Since html pages are nothing but text files, you might be able to do what you want with a shell script using 'sed' to make the changes.

Something like

sed -e 's/\/absolute\/directory/..\/directory/g' inputfile.html >outputfile.html

Google for 'sed', and/or do a 'man sed' on your system.
 
Old 02-14-2005, 02:39 AM   #3
devilkin
Member
 
Registered: Jan 2005
Location: Australia
Distribution: LFS 6.0 #15056
Posts: 50

Original Poster
Rep: Reputation: 15
Thanks for that Padma, i got it

The more i use linux the more i love it
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
global search and replace? jkcunningham Linux - General 5 03-15-2006 02:43 PM
Python search and replace Accordion Programming 1 02-22-2005 07:54 PM
search and replace C code vexer Programming 3 05-18-2004 11:11 PM
problem in perl replace command with slash (/) in search/replace string ramesh_ps1 Red Hat 4 09-10-2003 01:04 AM
Grep for search, but what for replace? TheSpecial Linux - Software 18 04-28-2003 09:01 AM


All times are GMT -5. The time now is 07:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration