Well, I finally picked up a sed/awk book and now I don't have to post to
the list on how to do the basic stuff... -- so now I've got a more legit
question with grouping. It seems not to be working for me.. the book I
have says that using () only works with (usually) egrep and awk. I'm not 
getting error messages, but, it isn't working either. 

I want to search for an ip address by using the string:

[0-9]\{3\}(\.[0-9]\{1,3\})\{3\}

(3 numbers, then 3 sets of a dot followed by 1 to 3 numbers).

If I run:

echo "asdfas .asd 216.123.34.123 asdfas asdf"|sed  
's/.*\([0-9]\{3\}(\.[0-9]\{1,3\})\{3\}\).*$/\1/'


I just get the original line back. If I search just with the basic 
string, it doesn't match:

echo "asdfas .asd 216.123.34.123 asdfas asdf"|sed  -n 
'/([0-9]\{3\}(\.[0-9]\{1,3\})\{3\}/p

outputs nothing.


I think the problem is with the grouping of the the runs of .### since: 

echo "asdfas .asd 216.23.123.43 asdf asd|sed  
's/.*\([0-9]\{3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\).*$/\1/'

works prefectly, but is a little long in syntax.

Thanks,

Ben



---------------------------------------------------------------------
To unsubscribe, e-mail: tclug-list-unsubscribe at mn-linux.org
For additional commands, e-mail: tclug-list-help at mn-linux.org