in reply to How to comment out lines in a text?

$ cat TAG MYTAG ( Line 1 Line 2 Line 3 ); NOTMYTAG ( foo bat ); MYTAG ( Line 1 Line 2 Line 3 ); $ perl -n -e 'BEGIN{$com=""}' -e '$com="#"if/^MYTAG\W/;print"$com$_";$ +com=""if/^\);$/' <TAG #MYTAG ( #Line 1 #Line 2 #Line 3 #); NOTMYTAG ( foo bat ); #MYTAG ( #Line 1 #Line 2 #Line 3 #);

Replies are listed 'Best First'.
(jeffa) 2Re: How to comment out lines in a text?
by jeffa (Bishop) on Mar 23, 2002 at 00:48 UTC
    Golf?
    perl -pe'$_="#$_"if/^MYTAG\W/../^\);$/'<TAG
    Hope you don't mind me using your regexes. ;)

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    

      Not at all.....

      perl -pe's/^/#/ if/^MYTAG\W/../^\);$/'<TAG

      ;)

        very nice ....
        same time tomorrow? ;)