LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 03-30-2005, 01:18 AM   #1
csstudy
LQ Newbie
 
Registered: May 2004
Posts: 15

Rep: Reputation: 0
how can i rewrite


i want to url rewrite from http://123.www.abc.com/a.html (to )http://www.abc.com/document/123/a.html, the "abc" is my host.

how can I rewrite
 
Old 03-30-2005, 01:35 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

This will probably do what you want:

sed 's%http://\(123\).http://www.abc.com/a.html%http://www...ent/\1/a.html%'

Sed is not bound to the / seperator, it can be any charachter as long as they are the same. Because your string contains /, I decide to use % as sed seperator.

The \(123\) in the searchstring and the \1 in the replacestring are 'special' and called backreference. The \1 is replaced with the content between \( and \) in the searchstring (123 in this case).

Hope this helps.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
rewrite command, how to? microsmart Linux - General 9 09-29-2005 03:21 PM
NTFS rewrite? chocobanana Linux - Security 4 06-01-2005 09:00 AM
L 80 80 ... How to rewrite MBR? manudath Linux - Software 2 02-27-2005 10:00 AM
Mod Rewrite Help carminejg3 Linux - Software 0 12-20-2004 05:19 PM
burn:/// can't rewrite? systinte5 Linux - Software 0 06-03-2004 03:07 PM


All times are GMT -5. The time now is 04:14 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration