Created
November 11, 2016 21:05
-
-
Save grahamlyons/0e1359ee93492b4a50f47f6f270cf5a2 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env bash | |
for file in $(ls *.csv) | |
do | |
prefix=$(echo ${file} | cut -d'_' -f1) | |
echo $prefix | |
tmpfile=$(tempfile) | |
while read line | |
do echo "${prefix},${line}" >> ${tmpfile} | |
done < ${file} | |
mv ${tmpfile} ${file} | |
rm ${tmpfile} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment