sed and string of data











up vote
2
down vote

favorite












I need to print the data starting from the line that matches Data after AB process=1234 (full 10): till end of the file.



I tried putting the data in a variable called "value" and using sed as below. However, it gives an error "extra characters at the end of D command.



value="Data after AB process=1234 (full 10):"
sed -n ' '$value' ' p datasourcefile.log









share|improve this question




























    up vote
    2
    down vote

    favorite












    I need to print the data starting from the line that matches Data after AB process=1234 (full 10): till end of the file.



    I tried putting the data in a variable called "value" and using sed as below. However, it gives an error "extra characters at the end of D command.



    value="Data after AB process=1234 (full 10):"
    sed -n ' '$value' ' p datasourcefile.log









    share|improve this question


























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I need to print the data starting from the line that matches Data after AB process=1234 (full 10): till end of the file.



      I tried putting the data in a variable called "value" and using sed as below. However, it gives an error "extra characters at the end of D command.



      value="Data after AB process=1234 (full 10):"
      sed -n ' '$value' ' p datasourcefile.log









      share|improve this question















      I need to print the data starting from the line that matches Data after AB process=1234 (full 10): till end of the file.



      I tried putting the data in a variable called "value" and using sed as below. However, it gives an error "extra characters at the end of D command.



      value="Data after AB process=1234 (full 10):"
      sed -n ' '$value' ' p datasourcefile.log






      sed






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 at 21:19









      Rui F Ribeiro

      38.2k1475125




      38.2k1475125










      asked Jun 25 '15 at 19:36









      alex

      6116




      6116






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          sed -n '/Data after AB process=1234 (full 10):/,$p' file


          or



          value='Data after AB process=1234 (full 10):'
          sed -n '/'"${value}"'/,$p' file


          Take a look at: Difference between single and double quotes in bash






          share|improve this answer























          • Thank you so much. I tried the second option and it worked
            – alex
            Jun 25 '15 at 19:54


















          up vote
          0
          down vote













          { grep -Fm1 'Data after AB process=1234 (full 10):'; cat; } <infile


          ...will work w/ a GNU grep and a regular input file.






          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',
            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
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f212235%2fsed-and-string-of-data%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








            up vote
            3
            down vote



            accepted










            sed -n '/Data after AB process=1234 (full 10):/,$p' file


            or



            value='Data after AB process=1234 (full 10):'
            sed -n '/'"${value}"'/,$p' file


            Take a look at: Difference between single and double quotes in bash






            share|improve this answer























            • Thank you so much. I tried the second option and it worked
              – alex
              Jun 25 '15 at 19:54















            up vote
            3
            down vote



            accepted










            sed -n '/Data after AB process=1234 (full 10):/,$p' file


            or



            value='Data after AB process=1234 (full 10):'
            sed -n '/'"${value}"'/,$p' file


            Take a look at: Difference between single and double quotes in bash






            share|improve this answer























            • Thank you so much. I tried the second option and it worked
              – alex
              Jun 25 '15 at 19:54













            up vote
            3
            down vote



            accepted







            up vote
            3
            down vote



            accepted






            sed -n '/Data after AB process=1234 (full 10):/,$p' file


            or



            value='Data after AB process=1234 (full 10):'
            sed -n '/'"${value}"'/,$p' file


            Take a look at: Difference between single and double quotes in bash






            share|improve this answer














            sed -n '/Data after AB process=1234 (full 10):/,$p' file


            or



            value='Data after AB process=1234 (full 10):'
            sed -n '/'"${value}"'/,$p' file


            Take a look at: Difference between single and double quotes in bash







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 23 '17 at 12:39









            Community

            1




            1










            answered Jun 25 '15 at 19:42









            Cyrus

            7,1712835




            7,1712835












            • Thank you so much. I tried the second option and it worked
              – alex
              Jun 25 '15 at 19:54


















            • Thank you so much. I tried the second option and it worked
              – alex
              Jun 25 '15 at 19:54
















            Thank you so much. I tried the second option and it worked
            – alex
            Jun 25 '15 at 19:54




            Thank you so much. I tried the second option and it worked
            – alex
            Jun 25 '15 at 19:54












            up vote
            0
            down vote













            { grep -Fm1 'Data after AB process=1234 (full 10):'; cat; } <infile


            ...will work w/ a GNU grep and a regular input file.






            share|improve this answer

























              up vote
              0
              down vote













              { grep -Fm1 'Data after AB process=1234 (full 10):'; cat; } <infile


              ...will work w/ a GNU grep and a regular input file.






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                { grep -Fm1 'Data after AB process=1234 (full 10):'; cat; } <infile


                ...will work w/ a GNU grep and a regular input file.






                share|improve this answer












                { grep -Fm1 'Data after AB process=1234 (full 10):'; cat; } <infile


                ...will work w/ a GNU grep and a regular input file.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jun 25 '15 at 20:21









                mikeserv

                45k566152




                45k566152






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f212235%2fsed-and-string-of-data%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

                    Accessing regular linux commands in Huawei's Dopra Linux

                    Can't connect RFCOMM socket: Host is down

                    Kernel panic - not syncing: Fatal Exception in Interrupt