csv2tbl.awk 349 B

123456789101112131415161718192021
  1. BEGIN {
  2. OFS=" & ";
  3. ORS=" \\\\\n";
  4. printf "\\begin{tabular}{%s}\n", tblFormat;
  5. printf "\\toprule\n";
  6. }
  7. NR==1 {
  8. for(i = 1 ; i <= NF ; i ++) {
  9. $i = sprintf( "\\textbf{%s}", $i);
  10. }
  11. print $0
  12. printf "\\midrule\n";
  13. }
  14. NR != 1 { $1=$1 ;print $0 }
  15. END {
  16. printf "\\bottomrule\n";
  17. printf "\\end{tabular}\n";
  18. }