Hello David, jeff and all
>
> > 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'
> '
I made the programm really to complex, everytime putting some
extra rules in ;).
As I had a problem with sed, i restructured the programm and
made it a lot simpler, doing the same and a lot faster :).
> This should work with a valid PAT....( it must be || )
> > 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....
found it in the chapter regular expression in a perl book :)
works fine , \W is all whitespace and return.
this was not the problem
----------------------
The problem i had was to convert a space into the '\W*' string.
>
> > 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?
correct. (allthough i made a typo here ,should have been echo not
cat )
> Your question sounded different than this; is there a reason the first
> example won't work
Yes, in the original setup. Not any more after the change.
But the question for me was, how do I insert a backslash with a
sed command.
> 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
>
So the statement is correct. I wanted to update sed also ;) but it is
again a little bit larger, and i wanted to stay compatible to the
busybox sed and disks with the 2.05 sed.
> # 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...........
I noticed and agree.
But if you have a programm that functions and i only wanted to
clean it up a little this caused a debugging session of several hours.
But resulted in a faster and better programm :=)
Thanks .
Eric Wolzak
http://leaf.sourceforge.net/devel/ericw
_______________________________________________
Leaf-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/leaf-devel