It was Wednesday, October 08, 2003 when Dan Muey took the soap box, saying: : Howdy list: : : Trying to do an inplace edit: : : perl -pi -e 's/whatever/newstuff/;' /file/path/here : : What I need to do is replace certain parts of the line for instance: : : : s/^$var:(.*):123:def/$var:\1:456:ghi/;
First, (.*) is very greedy. You might want to limit it in some way, possibly with a ? modifier like (.*?), possibly by looking for less than . such as ([^:]*) -- anything but a colon. Second, the backwack numbers \1 .. \9 are only for the matching portion of a subsitution. You must use their variable representations, $1 .. $9 in the replacement portion. Casey West -- The goal of Computer Science is to build something that will last at least until we've finished building it. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]