Use grep to search text in each csv file on S3 bucket

I am on AWS s3 bucket and there are hundreds of CSVs in the folder. I want to list (ie. ls) the name/s of the CSV file/s that contain the text/word that I am looking for.

aws s3 ls s3://path/folder/ | grep -l 'word' *.csv

The command above returns this error.

grep: *.csv: No such file or directory [Errno 32] Broken pipe Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'> BrokenPipeError: [Errno 32] Broken pipe

Please let me know how I can rewrite it, so that it displays the file/s that contain the text/word.

2 answers

  • answered 2021-11-23 03:05 Alexei Vladimirovich Kashenko

    Try this:

    grep -rn --include=*.csv "word"


    grep word *.csv

  • answered 2021-11-23 05:06 user3062459

    It does not appear that I will be able to search inside of CSVs "objects" inside of AWS s3. I would need to use a service like AWS Athena in order to do so.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum