Created
August 26, 2020 04:43
-
-
Save seathief/c5f62cb3353e90b341f62bcd347b9d3e to your computer and use it in GitHub Desktop.
merge utf-8 BOM csv files into single file and keep header from first file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ref:https://zzz.buzz/2016/07/30/bom-in-iconv/ | |
# ref:https://stackoverflow.com/questions/16890582/unixmerge-multiple-csv-files-with-same-header-by-keeping-the-header-of-the-firs | |
for filename in *.csv; do | |
sed -i 's/\xef\xbb\xbf//' $filename | |
done | |
awk 'FNR==1 && NR!=1{next;}{print}' *.csv > merge-bom.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment