I have a folder (Transactions) with hundreds of .csv files. I want to search through all csv files for a particular string and get the output of each line that contains that string. Preferably output to a txt file. For example, let's say I want to find any record that contains the name John Doe. In windows I would use the following:
FINDSTR /n /i "John.Doe" *.csv >> johndoe.txt
/nto give me the line number
/ito ignore case
"."to separate words
*.csvto search all files that end with .csv, and
>>to output to a new file which contains all data that includes the string (into the same folder).
I'm looking for a similar command to use in Ubuntu Terminal that will search through all .csv files and output any hits to a txt file. I've looked into grep and awk but don't know how to use them. Any help would be appreciated. Thanks.