Rusty Wright wrote:
[...]
The \( \) is the grouping thing where what matches in it is then
substituted for as the \1 on the right hand side.
Yes, but if you escape them with \ , do they still get seen as (meta)
grouping indicators, or as plain ( and ) ?
(I don't remember what sed wants
When you put a backslash in front of them they become part of the matching
machinery's special characters, like . [ and so on. Without the backslash
they're normal characters and matched as-is. So if you had the sed command
s/(a)+/z/ and you fed it the string aaa, you would not get back z.
Rusty Wright wrote:
I love shell script hacks so my /etc/init.d/tomcat script has the
following in the upper part where it's setting variables:
TOMCAT_HOME=`grep ^tomcat /etc/passwd | sed -e
's/.*:.*:.*:.*:.*:\(.*\):.*/\1/'`
You love shell scripts, but don't seem to love regexp's.
Thanks; good point about the speedup by not using .* (although since this is in
a boot script, in this case it shouldn't really matter much). The \( \) is the
grouping thing where what matches in it is then substituted for as the \1 on
the right hand side. Cut is one of those commands I