$ cat eps.txt
12/31/2022 $57.18 $53.10 20.55 22.38 $218.03 $200.19
9/30/2022 $55.39 $51.09 21.19 23.12 $211.49 $193.83
6/30/2022 $54.10 $49.25 21.90 23.95 $204.64 $187.11
3/31/2022 $51.36 $46.74 22.12 24.06 $202.57 $186.25
12/31/2021 $50.64 $46.75 22.56 24.16 $198.62 $185.46
9/30/2021 $48.54 $44.37 24.07 26.33 $186.16 $170.15
6/30/2021 (Prelim.) 4297.50 $52.03 $48.39 25.53 28.22 $175.52 $158.76
3/31/2021 3972.89 $47.41 $45.95 26.44 30.99 $150.28 $128.20
12/31/2020 3756.07 $38.18 $31.44 30.69 39.90 $122.37 $94.13
9/30/2020 3363.00 $37.90 $32.98 27.26 34.24 $123.37 $98.22
6/30/2020 3100.29 $26.79 $17.83 24.75 31.24 $125.28 $99.23
3/31/2020 2584.59 $19.50 $11.88 18.64 22.22 $138.63 $116.33
12/31/2019 3230.78 $39.18 $35.53 20.56 23.16 $157.12 $139.47
9/30/2019 2976.74 $39.81 $33.99 19.46 22.40 $152.97 $132.90
6/30/2019 2941.76 $40.14 $34.93 19.04 21.75 $154.54 $135.27
3/31/2019 2834.40 $37.99 $35.02 18.52 21.09 $153.05 $134.39
> eps_year_xts["2020::"]
[,1]
2020-01-01 116.33
2020-04-01 99.23
2020-07-01 98.22
2020-10-01 94.13
2021-01-01 122.64
2021-04-01 144.14
2021-07-01 153.96
2021-10-01 166.77
2022-01-01 170.06
2022-04-01 176.48
2022-07-01 182.75
2022-10-01 188.97
$ tac eps.txt | awk '{gsub("\\$","",$NF);print "eps_year_xts[\"2019::\"]["NR"] <- "$NF}'
eps_year_xts["2019::"][1] <- 134.39
eps_year_xts["2019::"][2] <- 135.27
eps_year_xts["2019::"][3] <- 132.90
eps_year_xts["2019::"][4] <- 139.47
eps_year_xts["2019::"][5] <- 116.33
eps_year_xts["2019::"][6] <- 99.23
eps_year_xts["2019::"][7] <- 98.22
eps_year_xts["2019::"][8] <- 94.13
eps_year_xts["2019::"][9] <- 128.20
eps_year_xts["2019::"][10] <- 158.76
eps_year_xts["2019::"][11] <- 170.15
eps_year_xts["2019::"][12] <- 185.46
eps_year_xts["2019::"][13] <- 186.25
eps_year_xts["2019::"][14] <- 187.11
eps_year_xts["2019::"][15] <- 193.83
eps_year_xts["2019::"][16] <- 200.19