in reply to add after $1

Update::I forgot to mention - you need to slurp the file, as hipowls(++) indicates below.

Your regex needs two changes:

This works:
s/^(if.*rctladm\.conf.*fi)/$1\n$here/sm;
However, may I suggest the following alternatives:

     "As you get older three things happen. The first is your memory goes, and I can't remember the other two... " - Sir Norman Wisdom

Replies are listed 'Best First'.
Re^2: add after $1
by wcj75019 (Acolyte) on Mar 20, 2008 at 22:25 UTC
    For some reason. Still, the $here doesn't print after the last fi. Thanks,