Executing local shell script commands in pigs
1 answer
Here's how you can run a shell command from 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 execution shell_command
will be available in command
, which will later be replaced in step generate
.
+4
source to share