Support Questions

Find answers, ask questions, and share your expertise

Create a loop to read files

avatar
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);

ex: 

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?

 

0 REPLIES 0