Support Questions

Find answers, ask questions, and share your expertise

Create a loop to read files

New Contributor

I have files with names called file1.txt, file2.txt, file3.txt. I'm current exploring pig where I am trying to read multiple files into pig. Is there a way where I could loop the following code? 

t1 = LOAD 'filename' t1 = LOAD 'filename' USING TextLoader() AS (string:chararray);


do file{1..3}.txt: 

  t* = LOAD 'file*" t1 = LOAD 'filename' USING TextLoader() AS (string:chararray);

which results in t1, t2, t3 for file1.txt, file2.txt and file3.txt?


Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.