regex help

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Matrix Mole
Date:  
To: Main PLUG discussion list
Subject: regex help
I've a quik question about doing some regex work. If I have a file that
has the same sequence of character in it (in my example, the path to my
home directory /home/matrixm) and I want to change only the second
occurrence of the path, how would I go about specifying that particular
one to manipulate? If it helps any, I'd like to know the regex that'd be
necessary in either vi or sed (so far to me it seems both use almost
identical regex). So for example, let's say I have a file that has 30-40
lines that look like this:

{some text} /home/matrixm {more text} /home/matrixm {even more text}

and I want to add onto the path of the second path so that instead it
looks like this:

{some text} /home/matrixm {more text} /home/matrixm/tmp {even more text}

I know that a switch command can do it
(s:/home/matrixm:/home/matrixm/tmp:) but I don't know how to force regex
to only work on the second occurrence of the pattern match.

Matrix Mole
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss