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,This >are< should not be counted,d,e,f
a,b,c,Hi I'm good. Are you ok ? d,e,f
a,b,c,Hi You are good, are you? d,e,f
a,b,c,I dare to add this line d,e,f
Here, how can I have to count the occurrences of the word 'are' in the message column using UNIX shell commands?
are
in other columns which should not be counted? (Otherwise it's trivial!) 2) ShouldAre
with capitalA
be counted, too? 3) Is there a comma missing after theC
in the first line?are
in wrong column, twoare
in one line andare
being part ofdare
. Is it right you want 1are
in lines 2, 3, 5 and 7, 2are
in line 6 and none in line 4?You are good, are you?
contains a comma, which is the field separator. That line has 7 fields rather than the usual 6. 3. it looks like there's a missing,
before columnD
. if that's the case then theYou are good
line has 8 fields rather than the normal 7.