Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian User (http://www.linux-archive.org/debian-user/)
-   -   sed help please (http://www.linux-archive.org/debian-user/235199-sed-help-please.html)

Daniel Dalton 01-27-2009 09:35 AM

sed help please
 
Hi,

I've come up with this sed command:
sed s//media// filename

One question, how can I include the / charactar in the search patton?
This works fine except, I need to add a / in the search patton, any
ideas how to do this so sed doesn't complain?

Thanks very much,

Daniel.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Axel Freyn 01-27-2009 10:11 AM

sed help please
 
Hi Daniel,
On Tue, Jan 27, 2009 at 09:35:46PM +1100, Daniel Dalton wrote:
> Hi,
>
> I've come up with this sed command:
> sed s//media// filename
>
> One question, how can I include the / charactar in the search patton?
> This works fine except, I need to add a / in the search patton, any
> ideas how to do this so sed doesn't complain?
Use a backslash bevor the slash/: "/" works fine


Axel


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Teemu Likonen 01-27-2009 10:20 AM

sed help please
 
Axel Freyn (2009-01-27 12:11 +0100) wrote:

> On Tue, Jan 27, 2009 at 09:35:46PM +1100, Daniel Dalton wrote:
>> sed s//media// filename
>>
>> One question, how can I include the / charactar in the search patton?
>> This works fine except, I need to add a / in the search patton, any
>> ideas how to do this so sed doesn't complain?

> Use a backslash bevor the slash/: "/" works fine

Yes, or use some other character to separate the parameters of "s"
command. This example uses comma:

sed -e 's,pattern,replacement,'

Then "/" does not need backslash-escaping but "," does.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Daniel Dalton 01-27-2009 11:11 AM

sed help please
 
Hi Axel,

> Use a backslash bevor the slash/: "/" works fine

Thanks, very much, that worked!

Cheers,

Daniel.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


All times are GMT. The time now is 05:13 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.