I have a folder with csv files whose file names are dates, viz.: January-01-2018.csv
, January-02-2018.csv
, ..., April-30-2018.csv
.
Using Bash preferably, I want to extract the number of lines from each csv file but doing so in order of date. i.e., I wish to extract the number of lines in January-01-2018.csv
and then January-02-2018.csv
... and then April-30-2018.csv
and so on.
At the moment, all I have is:
for filename in $(ls *.csv); do cat $filename | wc -l >> by_day.dat; done
But this does not take care of my operation in "ascending order of date".
Any suggestions on how I might accomplish this? I would like to do this using bash.