append brackets to all constants beginning with L:: where it not exist on endAdd space after 8 characters then add space after every 4 charactersCleaning PHP exploits from infected files using sedDelete multiple lines in a fileProblems with regex in grepsubstitute from beginning of line with 1 of multiple patterns to the end of another line with 2nd patternUse sed and sed alone to do a substitution on a line starting with a specific string only if !existHow to copy strings from middle of lines (between strings) to the end of linesBash variables in sed including an end of line conditionsed: couldn't write n items to stdout: Broken pipe. What are these errors?Find and replace inside string based on pattern and exception cases

Detention in 1997

Do UK voters know if their MP will be the Speaker of the House?

Avoiding direct proof while writing proof by induction

What is the most common color to indicate the input-field is disabled?

Alternative to sending password over mail?

CAST throwing error when run in stored procedure but not when run as raw query

Personal Teleportation: From Rags to Riches

Assassin's bullet with mercury

What exploit Are these user agents trying to use?

Why is this clock signal connected to a capacitor to gnd?

Am I breaking OOP practice with this architecture?

What reasons are there for a Capitalist to oppose a 100% inheritance tax?

Is it logically or scientifically possible to artificially send energy to the body?

Avoiding the "not like other girls" trope?

Why was the shrinking from 8″ made only to 5.25″ and not smaller (4″ or less)?

How can saying a song's name be a copyright violation?

One verb to replace 'be a member of' a club

Why can't we play rap on piano?

What does “the session was packed” mean in this context?

Are there any examples of a variable being normally distributed that is *not* due to the Central Limit Theorem?

What mechanic is there to disable a threat instead of killing it?

How writing a dominant 7 sus4 chord in RNA ( Vsus7 chord in the 1st inversion)

Why is it a bad idea to hire a hitman to eliminate most corrupt politicians?

Can compressed videos be decoded back to their uncompresed original format?



append brackets to all constants beginning with L:: where it not exist on end


Add space after 8 characters then add space after every 4 charactersCleaning PHP exploits from infected files using sedDelete multiple lines in a fileProblems with regex in grepsubstitute from beginning of line with 1 of multiple patterns to the end of another line with 2nd patternUse sed and sed alone to do a substitution on a line starting with a specific string only if !existHow to copy strings from middle of lines (between strings) to the end of linesBash variables in sed including an end of line conditionsed: couldn't write n items to stdout: Broken pipe. What are these errors?Find and replace inside string based on pattern and exception cases













1















I have many PHP Files where I need to add on end "()" to every constant beginning with "L::" which don't have on end "(". It should by applied to all *.php including subfolders) :



L::WHAT_EVER
<?=L::WHAT_EVER?>


should become:



L::WHAT_EVER()
<?=L::WHAT_EVER()?>


but not touch any of them:



L::WHAT_EVER()
L::WHAT_EVER('aaa')
L::WHAT_EVER($a, $b)


Is there any sed regex command that I could apply to reach this Goal?










share|improve this question







New contributor




nenad007 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1





    yes there is ...

    – ctac_
    2 days ago















1















I have many PHP Files where I need to add on end "()" to every constant beginning with "L::" which don't have on end "(". It should by applied to all *.php including subfolders) :



L::WHAT_EVER
<?=L::WHAT_EVER?>


should become:



L::WHAT_EVER()
<?=L::WHAT_EVER()?>


but not touch any of them:



L::WHAT_EVER()
L::WHAT_EVER('aaa')
L::WHAT_EVER($a, $b)


Is there any sed regex command that I could apply to reach this Goal?










share|improve this question







New contributor




nenad007 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1





    yes there is ...

    – ctac_
    2 days ago













1












1








1








I have many PHP Files where I need to add on end "()" to every constant beginning with "L::" which don't have on end "(". It should by applied to all *.php including subfolders) :



L::WHAT_EVER
<?=L::WHAT_EVER?>


should become:



L::WHAT_EVER()
<?=L::WHAT_EVER()?>


but not touch any of them:



L::WHAT_EVER()
L::WHAT_EVER('aaa')
L::WHAT_EVER($a, $b)


Is there any sed regex command that I could apply to reach this Goal?










share|improve this question







New contributor




nenad007 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I have many PHP Files where I need to add on end "()" to every constant beginning with "L::" which don't have on end "(". It should by applied to all *.php including subfolders) :



L::WHAT_EVER
<?=L::WHAT_EVER?>


should become:



L::WHAT_EVER()
<?=L::WHAT_EVER()?>


but not touch any of them:



L::WHAT_EVER()
L::WHAT_EVER('aaa')
L::WHAT_EVER($a, $b)


Is there any sed regex command that I could apply to reach this Goal?







shell sed regular-expression






share|improve this question







New contributor




nenad007 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




nenad007 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




nenad007 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 days ago









nenad007nenad007

82




82




New contributor




nenad007 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





nenad007 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






nenad007 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 1





    yes there is ...

    – ctac_
    2 days ago












  • 1





    yes there is ...

    – ctac_
    2 days ago







1




1





yes there is ...

– ctac_
2 days ago





yes there is ...

– ctac_
2 days ago










2 Answers
2






active

oldest

votes


















3














It's easier with perl:



perl -pi -e 's/bL::w++K(?!()/()/g' ./*.php



  • bL::: L:: following a word boundary (to avoid replacing NIL::Foo ones).


  • w: any word character (ASCII letters, numbers or underscore)


  • ++: one or more (of the ws), but don't backtrack


  • K: set the start of the matched portion (so just after that word)


  • (?!...): negative look ahead assertion. So here only matches if what follows is not a (.





share|improve this answer
































    1














    Perl and the better regex engine is easier as it has lookaround feature, for GNU sed testing:



    sed -E 's/(w+::w+)([^(].+)?/1()2/' ./*.php


    solving recursive glob process:



    find . -iname '*.php' -exec sed -E 's/(w+::w+)([^(].+)?/1()2/' '' +


    for its real editing, add -i option,



    find . -iname '*.php' -exec sed -i -E 's/(w+::w+)([^(].+)?/1()2/' '' +





    share|improve this answer

























      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );






      nenad007 is a new contributor. Be nice, and check out our Code of Conduct.









      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f509903%2fappend-brackets-to-all-constants-beginning-with-l-where-it-not-exist-on-end%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      3














      It's easier with perl:



      perl -pi -e 's/bL::w++K(?!()/()/g' ./*.php



      • bL::: L:: following a word boundary (to avoid replacing NIL::Foo ones).


      • w: any word character (ASCII letters, numbers or underscore)


      • ++: one or more (of the ws), but don't backtrack


      • K: set the start of the matched portion (so just after that word)


      • (?!...): negative look ahead assertion. So here only matches if what follows is not a (.





      share|improve this answer





























        3














        It's easier with perl:



        perl -pi -e 's/bL::w++K(?!()/()/g' ./*.php



        • bL::: L:: following a word boundary (to avoid replacing NIL::Foo ones).


        • w: any word character (ASCII letters, numbers or underscore)


        • ++: one or more (of the ws), but don't backtrack


        • K: set the start of the matched portion (so just after that word)


        • (?!...): negative look ahead assertion. So here only matches if what follows is not a (.





        share|improve this answer



























          3












          3








          3







          It's easier with perl:



          perl -pi -e 's/bL::w++K(?!()/()/g' ./*.php



          • bL::: L:: following a word boundary (to avoid replacing NIL::Foo ones).


          • w: any word character (ASCII letters, numbers or underscore)


          • ++: one or more (of the ws), but don't backtrack


          • K: set the start of the matched portion (so just after that word)


          • (?!...): negative look ahead assertion. So here only matches if what follows is not a (.





          share|improve this answer















          It's easier with perl:



          perl -pi -e 's/bL::w++K(?!()/()/g' ./*.php



          • bL::: L:: following a word boundary (to avoid replacing NIL::Foo ones).


          • w: any word character (ASCII letters, numbers or underscore)


          • ++: one or more (of the ws), but don't backtrack


          • K: set the start of the matched portion (so just after that word)


          • (?!...): negative look ahead assertion. So here only matches if what follows is not a (.






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 2 days ago

























          answered 2 days ago









          Stéphane ChazelasStéphane Chazelas

          312k57592948




          312k57592948























              1














              Perl and the better regex engine is easier as it has lookaround feature, for GNU sed testing:



              sed -E 's/(w+::w+)([^(].+)?/1()2/' ./*.php


              solving recursive glob process:



              find . -iname '*.php' -exec sed -E 's/(w+::w+)([^(].+)?/1()2/' '' +


              for its real editing, add -i option,



              find . -iname '*.php' -exec sed -i -E 's/(w+::w+)([^(].+)?/1()2/' '' +





              share|improve this answer





























                1














                Perl and the better regex engine is easier as it has lookaround feature, for GNU sed testing:



                sed -E 's/(w+::w+)([^(].+)?/1()2/' ./*.php


                solving recursive glob process:



                find . -iname '*.php' -exec sed -E 's/(w+::w+)([^(].+)?/1()2/' '' +


                for its real editing, add -i option,



                find . -iname '*.php' -exec sed -i -E 's/(w+::w+)([^(].+)?/1()2/' '' +





                share|improve this answer



























                  1












                  1








                  1







                  Perl and the better regex engine is easier as it has lookaround feature, for GNU sed testing:



                  sed -E 's/(w+::w+)([^(].+)?/1()2/' ./*.php


                  solving recursive glob process:



                  find . -iname '*.php' -exec sed -E 's/(w+::w+)([^(].+)?/1()2/' '' +


                  for its real editing, add -i option,



                  find . -iname '*.php' -exec sed -i -E 's/(w+::w+)([^(].+)?/1()2/' '' +





                  share|improve this answer















                  Perl and the better regex engine is easier as it has lookaround feature, for GNU sed testing:



                  sed -E 's/(w+::w+)([^(].+)?/1()2/' ./*.php


                  solving recursive glob process:



                  find . -iname '*.php' -exec sed -E 's/(w+::w+)([^(].+)?/1()2/' '' +


                  for its real editing, add -i option,



                  find . -iname '*.php' -exec sed -i -E 's/(w+::w+)([^(].+)?/1()2/' '' +






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 14 hours ago









                  Stéphane Chazelas

                  312k57592948




                  312k57592948










                  answered 15 hours ago









                  abdanabdan

                  374




                  374




















                      nenad007 is a new contributor. Be nice, and check out our Code of Conduct.









                      draft saved

                      draft discarded


















                      nenad007 is a new contributor. Be nice, and check out our Code of Conduct.












                      nenad007 is a new contributor. Be nice, and check out our Code of Conduct.











                      nenad007 is a new contributor. Be nice, and check out our Code of Conduct.














                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f509903%2fappend-brackets-to-all-constants-beginning-with-l-where-it-not-exist-on-end%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

                      Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

                      Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.