Executing local shell script commands in pigs

Can I exexute a shell script command from my unix directory on the pig filesystem?

+3


source to share


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







All Articles