I am completely new to pig.
Started to learn on my own and trying to know PIG.
Can anyone please suggest me to get the current system epoch time using pig by reading a words.txt file which having words.
I need the output as
word1_1234567890 word2_1234567890 word3_1234567890
Use CONCAT to combine your word with the epochtime.You can get the epochtime using ToUnixTime()
A = LOAD 'words.txt' AS (word:chararray); B = FOREACH A GENERATE CONCAT(CONCAT(A.word,'_'),(chararray)ToUnixTime(CurrentTime()); DUMP B;
Let's say your shell script is names test.sh
%declare my_shell_script 'test.sh' A = LOAD 'data.txt' AS (f1:int,f2:chararray); B = FOREACH A GENERATE '$my_shell_script';
If your shell script has parameter say param1
%declare my_shell_script 'test.sh $param1' A = LOAD 'data.txt' AS (f1:int,f2:chararray); B = FOREACH A GENERATE '$my_shell_script';