Lum – how to create a data file with a column of date from day1 to dayN

awkcolumnsdatetext processing

I was wondering if I could generate a hourly or daily time step date in a column starting from some year in the past to some day in the near past or today.
to be more clear, I want to create one column of data from 2000-10-10 100 to 2012-12-31 2400. The output file will look like

Date 

2000-01-01 100
2000-01-01 200
2000-01-01 300
.
.
.
.
.
2012-12-31 2400

Best Answer

#!/bin/bash

day=2000-01-01
end=2012-12-31

echo Date > output.file

until [[ $day > $end ]]; do
    printf "$day %d\n" $(seq 100 100 2400)
    day=$(date -d "$day + 1 day" +"%Y-%m-%d")
done >> output.file
Related Question