Hi again, But how does this allow me to say "Search for foo and replace it with bar. if you get to the end without finding foo add this line (which incidentally is the full line including foo and bar)
Example File contains foo1 = bar1 foo2 = bar2 foo4 = bar4 search for foo1 and replace bar* with bar1-1 if you don't find it add it search for foo2 and replace bar* with bar2-2 if you don't find it add it search for foo3 and replace bar* with bar3-3 if you don't find it add it search for foo4 and replace bar* with bar4-4 if you don't find it add it. The output should be foo1 = bar1-1 foo2 = bar2-2 foo3 = bar3-3 foo4 = bar4-4 Any ideas On Sunday 03 March 2002 02:35 pm, Jeff 'japhy' Pinyan wrote: > On Mar 3, Todd A. Jacobs said: > >On Sat, 2 Mar 2002, Steven M. Klass wrote: > >> if (/start/ .. /end/){ > >> s/^foo/bar/; > >> > >> } > > > > s/^foo/bar/ or s/^/bar/ ; > > You can just say: > > s/^(foo)?/bar/; > > or, if you like, > > s/^(?:foo)?/bar/; > > or even omit the ^. -- Steven M. Klass Physical Design Manager National Semiconductor Corp 7400 W. Detroit Street Suite 170 Chandler AZ 85226 Ph:480-753-2503 Fax:480-705-6407 [EMAIL PROTECTED] http://www.nsc.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]