Printing Characters after a ColonHow to use Sed to replace all characters before colon?How to include...

What happens when redirecting with 3>&1 1>/dev/null?

nginx conf: http2 module not working in Chrome in ubuntu 18.04

Is it normal to "extract a paper" from a master thesis?

size of pointers and architecture

Negative impact of having the launch pad away from the Equator

Why is this integration method not valid?

Why is a weak base more able to deprotonate a strong acid than a weak acid?

Why do testers need root cause analysis?

Caught with my phone during an exam

Is it safe to redirect stdout and stderr to the same file without file descriptor copies?

Computing elements of a 1000 x 60 matrix exhausts RAM

Salesforce bug enabled "Modify All"

Wifi light switch needs neutral wire. Why? AND Can that wire be a skinny one?

How to become an Editorial board member?

Is a world with one country feeding everyone possible?

Is there a word for pant sleeves?

mmap: effect of other processes writing to a file previously mapped read-only

Which values for voltage divider

VHDL: Why is it hard to desgin a floating point unit in hardware?

Illustrating that universal optimality is stronger than sphere packing

Are there any tips to help hummingbirds find a new feeder?

How do I write real-world stories separate from my country of origin?

Managing heat dissipation in a magic wand

What pc resources are used when bruteforcing?



Printing Characters after a Colon


How to use Sed to replace all characters before colon?How to include everything before Colon in Sed/Grep/…?sed: adding space around colonOutput only certain fieldsReplace special characters in specific fieldPrint match and line afteredit comma seperated fields and grep specific field bigger than my conditionPrinting columns using AWK?Extract substring after delimiter using GNU awk or awkPrinting one column from one file - awk






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















How do I print anything after the colon?



Input:



color:white,name:green


so I would like to print anything after :



Output:



white,green









share|improve this question































    1















    How do I print anything after the colon?



    Input:



    color:white,name:green


    so I would like to print anything after :



    Output:



    white,green









    share|improve this question



























      1












      1








      1


      1






      How do I print anything after the colon?



      Input:



      color:white,name:green


      so I would like to print anything after :



      Output:



      white,green









      share|improve this question
















      How do I print anything after the colon?



      Input:



      color:white,name:green


      so I would like to print anything after :



      Output:



      white,green






      awk sed regular-expression cut






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 20 '17 at 10:25









      Kevdog777

      2,122123461




      2,122123461










      asked Dec 20 '17 at 9:42









      αԋɱҽԃ αмєяιcαηαԋɱҽԃ αмєяιcαη

      5022725




      5022725






















          3 Answers
          3






          active

          oldest

          votes


















          4














          Simple sed approach (while your input is pretty simple):



          sed 's/[^,:]*://g' file


          The output:



          white,green





          share|improve this answer































            0














            You can also do this with grep:



            GNU grep



            grep -oP '(?<=:)w+'


            Portable grep



            grep -o ':[a-z]+' | tr -d :


            Output in both cases



            white
            green


            Note about output



            If you want the output as a comma-separated list, pipe to paste, e.g.:



            grep -o ':[a-z]+' | tr -d : | paste -sd, -


            Output:



            white,green





            share|improve this answer































              -1














              Using awk



              awk -F':' '{print $2}'





              share|improve this answer
























              • The statement of the question is vague,  but if you look at the sample data, you’ll see that this answer is wrong.

                – G-Man
                31 mins ago












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


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f412003%2fprinting-characters-after-a-colon%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              4














              Simple sed approach (while your input is pretty simple):



              sed 's/[^,:]*://g' file


              The output:



              white,green





              share|improve this answer




























                4














                Simple sed approach (while your input is pretty simple):



                sed 's/[^,:]*://g' file


                The output:



                white,green





                share|improve this answer


























                  4












                  4








                  4







                  Simple sed approach (while your input is pretty simple):



                  sed 's/[^,:]*://g' file


                  The output:



                  white,green





                  share|improve this answer













                  Simple sed approach (while your input is pretty simple):



                  sed 's/[^,:]*://g' file


                  The output:



                  white,green






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Dec 20 '17 at 9:45









                  RomanPerekhrestRomanPerekhrest

                  23.4k12548




                  23.4k12548

























                      0














                      You can also do this with grep:



                      GNU grep



                      grep -oP '(?<=:)w+'


                      Portable grep



                      grep -o ':[a-z]+' | tr -d :


                      Output in both cases



                      white
                      green


                      Note about output



                      If you want the output as a comma-separated list, pipe to paste, e.g.:



                      grep -o ':[a-z]+' | tr -d : | paste -sd, -


                      Output:



                      white,green





                      share|improve this answer




























                        0














                        You can also do this with grep:



                        GNU grep



                        grep -oP '(?<=:)w+'


                        Portable grep



                        grep -o ':[a-z]+' | tr -d :


                        Output in both cases



                        white
                        green


                        Note about output



                        If you want the output as a comma-separated list, pipe to paste, e.g.:



                        grep -o ':[a-z]+' | tr -d : | paste -sd, -


                        Output:



                        white,green





                        share|improve this answer


























                          0












                          0








                          0







                          You can also do this with grep:



                          GNU grep



                          grep -oP '(?<=:)w+'


                          Portable grep



                          grep -o ':[a-z]+' | tr -d :


                          Output in both cases



                          white
                          green


                          Note about output



                          If you want the output as a comma-separated list, pipe to paste, e.g.:



                          grep -o ':[a-z]+' | tr -d : | paste -sd, -


                          Output:



                          white,green





                          share|improve this answer













                          You can also do this with grep:



                          GNU grep



                          grep -oP '(?<=:)w+'


                          Portable grep



                          grep -o ':[a-z]+' | tr -d :


                          Output in both cases



                          white
                          green


                          Note about output



                          If you want the output as a comma-separated list, pipe to paste, e.g.:



                          grep -o ':[a-z]+' | tr -d : | paste -sd, -


                          Output:



                          white,green






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Dec 20 '17 at 15:48









                          ThorThor

                          12.4k13963




                          12.4k13963























                              -1














                              Using awk



                              awk -F':' '{print $2}'





                              share|improve this answer
























                              • The statement of the question is vague,  but if you look at the sample data, you’ll see that this answer is wrong.

                                – G-Man
                                31 mins ago
















                              -1














                              Using awk



                              awk -F':' '{print $2}'





                              share|improve this answer
























                              • The statement of the question is vague,  but if you look at the sample data, you’ll see that this answer is wrong.

                                – G-Man
                                31 mins ago














                              -1












                              -1








                              -1







                              Using awk



                              awk -F':' '{print $2}'





                              share|improve this answer













                              Using awk



                              awk -F':' '{print $2}'






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered 53 mins ago









                              SuppboiSuppboi

                              14




                              14













                              • The statement of the question is vague,  but if you look at the sample data, you’ll see that this answer is wrong.

                                – G-Man
                                31 mins ago



















                              • The statement of the question is vague,  but if you look at the sample data, you’ll see that this answer is wrong.

                                – G-Man
                                31 mins ago

















                              The statement of the question is vague,  but if you look at the sample data, you’ll see that this answer is wrong.

                              – G-Man
                              31 mins ago





                              The statement of the question is vague,  but if you look at the sample data, you’ll see that this answer is wrong.

                              – G-Man
                              31 mins ago


















                              draft saved

                              draft discarded




















































                              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%2f412003%2fprinting-characters-after-a-colon%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

                              Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                              Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                              Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...