Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Off the top of my head, how about something like:
    perl -pi.bak -e 's/^(COMMIT.*)/$1\nBEGIN;/' file.sql


    • Wheee! :) exactly that, but I did it inside a script. Small corrections, though.. its a case insensitive match, and if I dont match for a semicolon immediately after commit, I get matches for data ("committee") as well..

      I need to read perlopt again to decipher this one..

      • Those of us brought up on sed and awk have an advantage here. Generally, -p and -n are the most useful flags, as well as -i and (of course) -e, which is the actual code.

        If you've a perl journal subscription, there's a good article about command line perl in this months issue.