Best way to import a CSV with a repeated structure

Suppose your file looks like:

$ cat in.txt 
Day 1
1	10
2	20
3	15
4	20

Day 2
1	25
2	30
3	40
4	35

Day 3
1	40
2	45
3	30
4	15

A little Unix shell magic can be used to help Julia parse this as follows:

julia> using CSV, DataFrames

julia> CSV.read(pipeline(`awk 'BEGIN { day = "0"; print "day\ttime\tvalue" } /^Day/ { day = $2} /^[^D]/ {print day,"\t" $0}' in.txt`), DataFrame; delim='\t')
12×3 DataFrame
 Row │ day    time   value 
     │ Int64  Int64  Int64 
─────┼─────────────────────
   1 │     1      1     10
   2 │     1      2     20
   3 │     1      3     15
   4 │     1      4     20
   5 │     2      1     25
   6 │     2      2     30
   7 │     2      3     40
   8 │     2      4     35
   9 │     3      1     40
  10 │     3      2     45
  11 │     3      3     30
  12 │     3      4     15

The key useful info is the way awk tool is used to separate the important data lines from the intra-file headers, and to process the data in the header to enable adding it later to each line separately. This is the awk command on its own:

awk 'BEGIN { day = "0"; print "day\ttime\tvalue" } /^Day/ { day = $2} /^[^D]/ {print day,"\t" $0}' in.txt

Hopefully the awk logic is clear enough.

P.S. screenshots are annoying in a post. Try to insert copy-pasteable stuff