Finding a substring in a column of CSV fileHow to Prefix a column values with an apostrophe ( ' )?Single read...

Beyond Futuristic Technology for an Alien Warship?

Would a horse be sufficient buffer to prevent injury when falling from a great height?

What would happen if I build a half bath without permits?

Detail vs. filler

How to add the real hostname in the beginning of Linux cli command

How to work around players whose backstory goes against the story?

Why isn't there armor to protect from spells in the Potterverse?

Garage door sticks on a bolt

Is it possible for a company to grow but its stock price stays the same or decrease?

My machine, client installed VPN,

Why is STARTTLS used when it can be downgraded very easily?

How can I visualize an ordinal variable predicting a continuous outcome?

Was the ruling that prorogation was unlawful only possible because of the creation of a separate supreme court?

Can an energy drink or chocolate before an exam be useful ? What sort of other edible goods be helpful?

How to level a picture frame hung on a single nail?

How do my husband and I get over our fear of having another difficult baby?

Verb ending in -ん with positive meaning?

GPLv3 forces us to make code available, but to who?

Looking for circuit board material that can be dissolved

To what degree did the Supreme Court limit Boris Johnson's ability to prorogue?

How to compare integers in TeX?

The differences amongst f[x_], f[x__], and f[x___]

Is there a pattern for handling conflicting function parameters?

How big would the ice ball have to be to deliver all the water at once?



Finding a substring in a column of CSV file


How to Prefix a column values with an apostrophe ( ' )?Single read filter csv based on 1st column valuesMerging two CSV compared by a specific column onlySelecting rows in a CSV file based on column value that contains an embedded commaGrep Command to Search Only One Column of CSV FileHow to do multiple splits of a csv file based on unique column values?Bash-search and replace-Merge columns in CSV fileCount the number of occurrences of a substring in a stringHow to split CSV file by first column being a multiple of n






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







0















I have a csv file with around 15000 lines and multiple columns. The data set looks like this:



A,B,C    message               D, E, F
a,b,c,Hi how are you ? d,e,f
a,b,c,Hi Hello.Are you ok? d,e,f
a,b,c,Hi I'm good. Are you ok ? d,e,f
a,b,c,Hi how are you ? d,e,f


Here, how can I have to count the occurrences of the word 'are' in the message column using UNIX shell commands?










share|improve this question









New contributor



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




























    0















    I have a csv file with around 15000 lines and multiple columns. The data set looks like this:



    A,B,C    message               D, E, F
    a,b,c,Hi how are you ? d,e,f
    a,b,c,Hi Hello.Are you ok? d,e,f
    a,b,c,Hi I'm good. Are you ok ? d,e,f
    a,b,c,Hi how are you ? d,e,f


    Here, how can I have to count the occurrences of the word 'are' in the message column using UNIX shell commands?










    share|improve this question









    New contributor



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
























      0












      0








      0








      I have a csv file with around 15000 lines and multiple columns. The data set looks like this:



      A,B,C    message               D, E, F
      a,b,c,Hi how are you ? d,e,f
      a,b,c,Hi Hello.Are you ok? d,e,f
      a,b,c,Hi I'm good. Are you ok ? d,e,f
      a,b,c,Hi how are you ? d,e,f


      Here, how can I have to count the occurrences of the word 'are' in the message column using UNIX shell commands?










      share|improve this question









      New contributor



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











      I have a csv file with around 15000 lines and multiple columns. The data set looks like this:



      A,B,C    message               D, E, F
      a,b,c,Hi how are you ? d,e,f
      a,b,c,Hi Hello.Are you ok? d,e,f
      a,b,c,Hi I'm good. Are you ok ? d,e,f
      a,b,c,Hi how are you ? d,e,f


      Here, how can I have to count the occurrences of the word 'are' in the message column using UNIX shell commands?







      linux bash awk sed grep






      share|improve this question









      New contributor



      Krishna Manchodu 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



      Krishna Manchodu 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








      edited 13 mins ago









      msp9011

      6,2636 gold badges44 silver badges70 bronze badges




      6,2636 gold badges44 silver badges70 bronze badges






      New contributor



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








      asked 15 mins ago









      Krishna ManchoduKrishna Manchodu

      11 bronze badge




      11 bronze badge




      New contributor



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




      New contributor




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



























          1 Answer
          1






          active

          oldest

          votes


















          0
















          Try this,



           grep -oc are file




          • -o Print only the matched part


          • -c print the count of matching pattern


          You can add -i option if u need the result for Are also. Which will ignore the case sensitive of matching pattern



          Using AWK:



          awk -F ',' '$4 ~ /are/ {count++} END{print count}' file
          awk -F ',' '$4 ~ /[Aa]re/ {count++} END{print count}' file




          share




























            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/4.0/"u003ecc by-sa 4.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
            });


            }
            });







            Krishna Manchodu 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%2f543578%2ffinding-a-substring-in-a-column-of-csv-file%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0
















            Try this,



             grep -oc are file




            • -o Print only the matched part


            • -c print the count of matching pattern


            You can add -i option if u need the result for Are also. Which will ignore the case sensitive of matching pattern



            Using AWK:



            awk -F ',' '$4 ~ /are/ {count++} END{print count}' file
            awk -F ',' '$4 ~ /[Aa]re/ {count++} END{print count}' file




            share






























              0
















              Try this,



               grep -oc are file




              • -o Print only the matched part


              • -c print the count of matching pattern


              You can add -i option if u need the result for Are also. Which will ignore the case sensitive of matching pattern



              Using AWK:



              awk -F ',' '$4 ~ /are/ {count++} END{print count}' file
              awk -F ',' '$4 ~ /[Aa]re/ {count++} END{print count}' file




              share




























                0














                0










                0









                Try this,



                 grep -oc are file




                • -o Print only the matched part


                • -c print the count of matching pattern


                You can add -i option if u need the result for Are also. Which will ignore the case sensitive of matching pattern



                Using AWK:



                awk -F ',' '$4 ~ /are/ {count++} END{print count}' file
                awk -F ',' '$4 ~ /[Aa]re/ {count++} END{print count}' file




                share













                Try this,



                 grep -oc are file




                • -o Print only the matched part


                • -c print the count of matching pattern


                You can add -i option if u need the result for Are also. Which will ignore the case sensitive of matching pattern



                Using AWK:



                awk -F ',' '$4 ~ /are/ {count++} END{print count}' file
                awk -F ',' '$4 ~ /[Aa]re/ {count++} END{print count}' file





                share











                share


                share










                answered 7 mins ago









                msp9011msp9011

                6,2636 gold badges44 silver badges70 bronze badges




                6,2636 gold badges44 silver badges70 bronze badges


























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










                    draft saved

                    draft discarded

















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













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












                    Krishna Manchodu 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%2f543578%2ffinding-a-substring-in-a-column-of-csv-file%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...