Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Store pig result in a text file

Hi stackoverflow community;

i'm totally new to pig, i want to STORE the result in a text file and name it as i want. is it possible do this using STORE function.

My code:

a = LOAD 'example.csv' USING PigStorage(';');

b = FOREACH a GENERATE $0,$1,$2,$3,$6,$7,$8,$9,$11,$12,$13,$14,$20,$24,$25;

STORE b INTO ‘myoutput’;

Thanks.

like image 312
user1931853 Avatar asked Dec 25 '22 19:12

user1931853


1 Answers

Yes you will be able to store your result in myoutput.txt and you can load the data into file with any delimiter you want using PigStorage.

a = LOAD 'example.csv' USING PigStorage(';');
b = FOREACH a GENERATE $0,$1,$2,$3,$6,$7,$8,$9,$11,$12,$13,$14,$20,$24,$25;
STORE b INTO ‘myoutput.txt’ using PigStorage(';');
like image 95
salmanbw Avatar answered Jan 05 '23 16:01

salmanbw