I want the unique headers for a bunch of csv
files whose names contain ABC
or XYZ
.
Within a single directory, I can sort of get what I need with:
head -n ` *.csv > first.txt
cat -A first.txt | tr ',' '\n' | sort | uniq
Of course, this isn't recursive and it includes all csv
files, not just the ones I want.
If I do the following, I get the recursive search, but also a bunch of junk:
find . -type f -name "ABC*.csv" -o -name "XYZ*.csv" | xargs head -n 1 | tr ',' '\n' | sort | uniq
I'm on Windows 10 with MinGW64. I suppose I could use Python, but I feel so close to having it!