#! /bin/bash
# Last edited on 2021-01-05 19:02:41 by jstolfi

# Splits one or more data files of US consumer prices in "00-DATA/raw/" 
# into separate files in "00-DATA/split/", one for each series.
# Keeps only monthly data, discarding year and semester averages.

dfiles=( "$@" ) # Names of data files, minus the "cu.data." prefix.

for ff in "${dfiles[@]}" ; do
  fname="00-DATA/raw/cu.data.${ff}"
  ename="00-DATA/split/split.${ff}.log"
  echo "=== ${fname} ===" 1>&2
  split_cu_data_file.gawk \
    < ${fname} \
    2>&1 > ${ename}
  cat ${ename} 1>&2
done
