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

Time:11-23

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.

CodePudding user response:

Try this:

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

or:

grep word *.csv

CodePudding user response:

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.

  • Related