Perl monking (was Menu{Master,Maestro,etc} question(s)

Jay R. Ashworth jra at baylink.com
Mon May 14 12:32:11 PDT 2007


On Mon, May 14, 2007 at 03:11:30PM -0400, Fairlight wrote:
> > MsUs-1:/appl/filepro/dddtmp # mmreplace ./prc.jra tstdate replacement
> > syntax error at -e line 3, near ")
> >     s/^(.+:[^:]+")[^"]+(".*)/$1${sub}$2/"
> > Execution of -e aborted due to compilation errors.
> 
> Put {} around the action in the if statement; this ain't python.

 ===
# mmreplace - use perl to fake a MenuMaster :replace: command
#
# original written Tue May  8 16:23:19 EDT 2007 by jra at microsys.us
# rewritten by fairlite; tnx

[ $# = 3 ] ||
        {
        echo "usage: $0 filename line-label replacement"
        exit 1
        }

perl -pi.bak -e 'BEGIN {$label=shift; $sub=shift;}
        if (/^$label:/) {
                s/^(.+:[^:]+")[^"]+(".*)/$1${sub}$2/; }' $2 $3 $1
 ===

Up next: mmselector :-)

Cheers,
-- jra
-- 
Jay R. Ashworth                                                jra at baylink.com
Designer                          Baylink                             RFC 2100
Ashworth & Associates        The Things I Think                        '87 e24
St Petersburg FL USA      http://baylink.pitas.com             +1 727 647 1274


More information about the Filepro-list mailing list