Eric Wolzak wrote:

> I need for a weblet a function that first check if teststring is already
> inserted in a file, if not it will be inserted. This to prevent that
> reloading will cause repeated insertions.

Something like this?

grep -q "$PAT" && sed '1i\
'$PAT'
'

This should work with a valid PAT....

> due to conversions ( Escape sequences) there can be a
> variable amount of whitespace between 2 parts of the teststring
> therefore i used \W*

I don't find \W in my book for sed or grep.... however....

> grep "1.2.3.4/24\W*eth0" file  does function but :

This will find your pattern, and display it.

> now i wanted to change the space in teststring to \W* to be able to
> test.
> <PROBLEM>
> cat teststring | sed 's/ /\\W*/g'
> </PROBLEM>
> this results however in 1.2.3.4W*eth0 and not in 1.2.3.4\W*eth0
> I don't succeed in inserting the escape character.

According to your sed statement, you want to insert the character
string '\W*' in place of a single space?

Your question sounded different than this; is there a reason the first
example won't work?

I tried your sed statement with GNU sed 3.02 - which I think is what
Oxygen uses - and it works:

# cat test
one two three

# sed 's/ /\\W*/g' test
one\W*two\W*three

# sed -V
GNU sed Version 3.02

I did this on Red Hat 6.0, but the version of sed should be the same -
it sounds right, anyhow.

> experimenting with even more \\ :(
> Do I something wrong here, or is this a bug in the Eigerstein Sed -
> V 2.05  ?

LRP 2.9.7 came with a complete version of GNU sed; thus Oxygen does
also.

> sigh never cleanup a programm that functions

Never leave a program alone :-)  It can always be done
better...........

_______________________________________________
Leaf-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/leaf-devel

Reply via email to