Reputation: 33
Is it possible to exexute a shell script command from my unix directory in pig file system?
Upvotes: 3
Views: 2049
Reputation: 799
Here's how you can run a shell command from within your Pig script:
--declare a shell command
%declare command `shell_command`
file = LOAD 'file.txt' AS (colA:chararray, colB:int) ;
file_processed = FOREACH file GENERATE colA, colB, (command) AS colC ;
The result of the shell_command
execution would be available in command
which is later substituted in the generate
step.
Upvotes: 4