Brad Lucas

A blog mostly about programming
July 23, 2017

Csv Headers

To show the headers for each csv file in a directory.

#!/bin/bash

# Echo the header lines for all the cvs files in the current directory

for filename in *.csv;
do
  # echo $filename;
  line=$(head -n 1 $filename);
  echo $line;
done

Tags: csv