How to read a csv and count keywords

HI,

I want to read a csv. This csv is having a lot of data, but I am interested in the keywords. I want to count them. How can it be done?

Hi Anjali,
you can try $system() system task with Linux command to get no of keywords in your file.
i.e to calculate num of word_spec ( string type ) in file_name you can use following :
$system($sformatf(“grep -r -o %0s %0s | wc -l | tee line_1”,word_spec,file_name));

this will store number of keyword in line_1 file. and you can read that file to get actual number of keyword…

Regards,
-Dhaval

In reply to Anjali:

This is something you probably don’t want to use SystemVerilog for. Awk, Perl, or Python might be better. It would help to show a small sample CSV file and what you want to do with it.