Unix administration - strange problem with sed

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > March 2004 > strange problem with sed





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author strange problem with sed
bernd

2004-03-05, 5:34 pm

hy group

i know, this is a frequently question answered many times but...
i simply couldn't get it to work!

i try to substitute in sed a variable like:

echo "hammel=bammel" | sed -e "s/hammel/$HOME/"

i've read a lot about using doublequotes and stuff but i get:

$ echo "hammel=bammel" | sed -e "s/hammel/$HOME/"
sed: -e expression #1, char 11: Unknown option to `s'

maybe i'm just to stupid but i realy going crasy about this...

any help really appreciate

thanx in advance

bernd
Warren Block

2004-03-05, 5:34 pm

bernd <bernd@thebc.ch> wrote:

> $ echo "hammel=bammel" | sed -e "s/hammel/$HOME/"
> sed: -e expression #1, char 11: Unknown option to `s'


Hint:

echo "s/hammel/$HOME/"

--
Warren Block * Rapid City, South Dakota * USA
John Wingate

2004-03-05, 5:34 pm

Warren Block <wblock@wonkity.com> wrote:
> bernd <bernd@thebc.ch> wrote:


[color=darkred]
> Hint:


> echo "s/hammel/$HOME/"


You are not limited to using "/" as the delimiter. Warren's hint shows
why another delimiter may be useful at times. Bernd will have better
luck with:

echo "hammel=bammel" | sed -e "s:hammel:$HOME:"

(if there are no colons in "$HOME").

--
John Wingate Language serves three functions. One is to
johnww@worldpath.net communicate ideas, one is to conceal ideas, and
the third is to conceal the absence of ideas.
--Otto Jespersen
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com