Created
February 27, 2014 09:44
-
-
Save coppeliaMLA/9247171 to your computer and use it in GitHub Desktop.
Hive seems to struggle with files headers when loading flat files. Here's a bit of python to trim the first line (i.e. the column header line) from every 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
import os | |
dir = 'put your director in here' | |
for filename in os.listdir(dir): | |
with open(dir+filename, 'r') as fin: | |
data = fin.read().splitlines(True) | |
with open(dir+filename, 'w') as fout: | |
fout.writelines(data[1:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment