Home > Blockchain >  How to get a line count of all individual files in a directory on AWS S3 using a terminal?
How to get a line count of all individual files in a directory on AWS S3 using a terminal?

Time:02-24

I am new to terminal commands. I know we can do something like wc -l directory/* if the files were local. But how do I achieve the same on AWS S3 using a terminal? The output should be the file name and the count.

For example, there are two files present in a directory in S3 - 'abcd.txt' (5 lines in the file) and 'efgh.txt' (10 lines in the file). I want the line counts of each file without downloading the files, using terminal. Output - 'abcd.txt' 5 'efgh.txt' 10

CodePudding user response:

It is not possible with a simple command. Amazon S3 does not provide the ability to 'remotely' count the number of lines in an object.

Instead, you would need to download the files to your computer and then count the number of lines.

  • Related