如何将 pig 命令的输出转移到文本文件以便打印出来?

How to divert the output of pig command to a text file in order to print it out?

    2015-09-24 01:59:28,436 [main] INFO  org.apache.pig.newplan.logical.optimizer.LogicalPlanOptimizer - {RULES_ENABLED=[AddForEach, ColumnMapKeyPrune, ConstantCalculator, GroupByConstParallelSetter, LimitOptimizer, LoadTypeCastInserter, MergeFilter, MergeForEach, PartitionFilterOptimizer, PredicatePushdownOptimizer, PushDownForEachFlatten, PushUpFilter, SplitFilter, StreamTypeCastInserter]}
    2015-09-24 01:59:28,539 [main] INFO  org.apache.hadoop.conf.Configuration.deprecation - fs.default.name is deprecated. Instead, use fs.defaultFS
    2015-09-24 01:59:28,556 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MRCompiler - File concatenation threshold: 100 optimistic? false
    2015-09-24 01:59:28,560 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MultiQueryOptimizer - MR plan size before optimization: 1
    2015-09-24 01:59:28,561 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MultiQueryOptimizer - MR plan size after optimization: 1
    2015-09-24 01:59:28,620 [main] INFO  org.apache.hadoop.conf.Configuration.deprecation - fs.default.name is deprecated. Instead, use fs.defaultFS
    2015-09-24 01:59:28,624 [main] INFO  org.apache.hadoop.yarn.client.RMProxy - Connecting to ResourceManager at /0.0.0.0:8032
    2015-09-24 01:59:28,638 [main] INFO  org.apache.pig.tools.pigstats.mapreduce.MRScriptState - Pig script settings are added to the job
    2015-09-24 01:59:28,640 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobControlCompiler - mapred.job.reduce.markreset.buffer.percent is not set, set to default 0.3
    2015-09-24 01:59:28,641 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobControlCompiler - This job cannot be converted run in-process
    2015-09-24 01:59:29,268 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobControlCompiler - Added jar file:/home/vivek/Applications/pig/pig-0.14.0-core-h2.jar to DistributedCache through /tmp/temp-1176581946/tmp-2078805221/pig-0.14.0-core-h2.jar
    2015-09-24 01:59:29,452 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobControlCompiler - Added jar file:/home/vivek/Applications/pig/lib/automaton-1.11-8.jar to DistributedCache through /tmp/temp-1176581946/tmp-1750967439/automaton-1.11-8.jar
    2015-09-24 01:59:29,538 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobControlCompiler - Added jar file:/home/vivek/Applications/pig/lib/antlr-runtime-3.4.jar to DistributedCache through /tmp/temp-1176581946/tmp1997290065/antlr-runtime-3.4.jar
    2015-09-24 01:59:29,843 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobControlCompiler - Added jar file:/home/vivek/Applications/hadoop/share/hadoop/common/lib/guava-11.0.2.jar to DistributedCache through /tmp/temp-1176581946/tmp-256046780/guava-11.0.2.jar
    2015-09-24 01:59:29,990 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobControlCompiler - Added jar file:/home/vivek/Applications/pig/lib/joda-time-2.1.jar to DistributedCache through /tmp/temp-1176581946/tmp955728106/joda-time-2.1.jar
    2015-09-24 01:59:30,129 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobControlCompiler - Setting up single store job
    2015-09-24 01:59:30,131 [main] INFO  org.apache.pig.data.SchemaTupleFrontend - Key [pig.schematuple] is false, will not generate code.
    2015-09-24 01:59:30,131 [main] INFO  org.apache.pig.data.SchemaTupleFrontend - Starting process to move generated code to distributed cacche
    2015-09-24 01:59:30,132 [main] INFO  org.apache.pig.data.SchemaTupleFrontend - Setting key [pig.schematuple.classes] with classes to deserialize []
    2015-09-24 01:59:30,276 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - 1 map-reduce job(s) waiting for submission.
    2015-09-24 01:59:30,283 [JobControl] INFO  org.apache.hadoop.yarn.client.RMProxy - Connecting to ResourceManager at /0.0.0.0:8032
    2015-09-24 01:59:30,568 [JobControl] WARN  org.apache.hadoop.mapreduce.JobSubmitter - No job jar file set.  User classes may not be found. See Job or Job#setJar(String).
    2015-09-24 01:59:30,868 [JobControl] INFO  org.apache.hadoop.mapreduce.lib.input.FileInputFormat - Total input paths to process : 1
    2015-09-24 01:59:30,871 [JobControl] INFO  org.apache.pig.backend.hadoop.executionengine.util.MapRedUtil - Total input paths to process : 1
    2015-09-24 01:59:30,874 [JobControl] INFO  org.apache.pig.backend.hadoop.executionengine.util.MapRedUtil - Total input paths (combined) to process : 1
    2015-09-24 01:59:31,190 [JobControl] INFO  org.apache.hadoop.mapreduce.JobSubmitter - number of splits:1
    2015-09-24 01:59:31,499 [JobControl] INFO  org.apache.hadoop.mapreduce.JobSubmitter - Submitting tokens for job: job_1443082231600_0003
    2015-09-24 01:59:31,516 [JobControl] INFO  org.apache.hadoop.mapred.YARNRunner - Job jar is not present. Not adding any jar to the list of resources.
    2015-09-24 01:59:31,704 [JobControl] INFO  org.apache.hadoop.yarn.client.api.impl.YarnClientImpl - Submitted application application_1443082231600_0003
    2015-09-24 01:59:31,738 [JobControl] INFO  org.apache.hadoop.mapreduce.Job - The url to track the job: http://ubuntu:8088/proxy/application_1443082231600_0003/
    2015-09-24 01:59:31,742 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - HadoopJobId: job_1443082231600_0003
    2015-09-24 01:59:31,745 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - Processing aliases highsal,salaries
    2015-09-24 01:59:31,745 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - detailed locations: M: salaries[3,10],salaries[-1,-1],highsal[13,9] C:  R: 
    2015-09-24 01:59:31,781 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - 0% complete
    2015-09-24 01:59:31,782 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - Running jobs are [job_1443082231600_0003]
2015-09-24 02:00:48,025 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - 50% complete
2015-09-24 02:00:48,025 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - Running jobs are [job_1443082231600_0003]
2015-09-24 02:00:53,055 [main] INFO  org.apache.hadoop.yarn.client.RMProxy - Connecting to ResourceManager at /0.0.0.0:8032
2015-09-24 02:00:53,104 [main] INFO  org.apache.hadoop.mapred.ClientServiceDelegate - Application state is completed. FinalApplicationStatus=SUCCEEDED. Redirecting to job history server
2015-09-24 02:00:58,180 [main] INFO  org.apache.hadoop.ipc.Client - Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
2015-09-24 02:00:59,182 [main] INFO  org.apache.hadoop.ipc.Client - Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
2015-09-24 02:01:00,185 [main] INFO  org.apache.hadoop.ipc.Client - Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)        
(F,96,86000.0,95105)
(M,24,80000.0,95050)
(F,84,89000.0,94040)
(M,36,85000.0,95101)
(F,69,91000.0,95050)
(F,96,80000.0,95051)
(M,78,87000.0,95105)
(M,25,96000.0,95103)
(M,89,90000.0,95102)
(F,82,77000.0,95051)
(M,97,96000.0,95102)
(F,39,82000.0,95051)
(M,36,79000.0,95101)
(M,75,84000.0,95103)
(F,78,91000.0,95102)
(M,59,77000.0,95051)
(F,52,76000.0,95050)
(M,52,97000.0,95102)
(F,28,98000.0,95105)
(M,91,96000.0,94041)
(F,47,85000.0,95051)
(M,79,85000.0,95101)
(F,93,93000.0,95102)
(F,33,82000.0,95101)
(F,77,96000.0,95103)
(F,93,84000.0,95051)
(M,23,83000.0,95050)
(M,54,97000.0,95101)
(F,25,93000.0,94040)
(M,52,85000.0,95102)
(M,60,78000.0,94040)
(F,74,89000.0,94040)
(F,23,76000.0,95101)
(M,46,93000.0,95051)
(F,63,92000.0,95105)
(F,86,93000.0,95101)
(F,37,95000.0,95101)
(M,41,89000.0,95050)
(F,89,77000.0,94041)
(F,82,84000.0,95050)
(M,66,96000.0,95051)
(F,75,79000.0,95051)
(M,91,90000.0,95105)
(M,27,98000.0,95051)
(M,24,85000.0,94041)
(M,82,96000.0,95050)
(F,75,88000.0,95101)
(F,80,77000.0,95051)
(M,63,80000.0,95101)
(M,29,86000.0,95103)
(F,44,91000.0,95101)
(M,40,78000.0,95103)
(F,46,83000.0,95051)
(F,42,85000.0,95105)
(M,44,90000.0,95102)
(F,26,90000.0,94041)
(F,31,87000.0,95051)
(F,88,76000.0,95050)
(M,67,87000.0,95102)
(F,58,86000.0,94041)
(F,57,85000.0,95051)
(M,97,85000.0,95101)
(M,73,90000.0,95103)
(M,47,95000.0,95105)
(F,83,98000.0,94040)
(F,56,78000.0,95101)
(M,72,89000.0,94041)
(M,90,99000.0,95101)
(F,59,79000.0,95105)
(F,32,84000.0,95051)
(F,60,93000.0,95103)
(M,47,87000.0,94041)
(M,52,87000.0,95103)
(M,82,92000.0,95051)
(M,39,87000.0,95102)
(F,93,89000.0,95103)
(M,31,88000.0,95050)
(M,21,92000.0,94040)
(F,65,84000.0,95050)
(M,68,89000.0,94041)
(F,63,92000.0,94041)
(F,95,77000.0,95050)
(F,34,98000.0,95102)
(F,44,94000.0,94040)
(M,69,81000.0,95103)
(F,30,85000.0,95051)
(F,85,82000.0,95050)
(M,75,78000.0,94040)
(F,91,94000.0,95105)
(F,71,91000.0,94041)
(M,39,91000.0,95051)
(M,43,90000.0,95105)
(F,35,94000.0,94040)
(F,41,83000.0,95051)
(M,62,94000.0,94041)
(F,38,77000.0,94041)
(F,63,89000.0,95051)
(M,78,90000.0,95050)
(M,65,92000.0,95101)
(F,42,94000.0,95103)
(M,65,80000.0,95103)
(F,38,91000.0,95102)
(M,58,93000.0,94040)
(F,63,83000.0,95103)
(F,23,96000.0,95103)
(F,43,96000.0,95102)
(F,27,86000.0,94041)
(M,94,76000.0,94041)
(F,53,79000.0,94041)
(M,78,79000.0,95102)
(F,62,82000.0,95101)
(M,86,83000.0,95051)
(F,91,98000.0,95105)
(M,61,99000.0,95103)
(M,58,94000.0,95050)
(F,47,99000.0,95102)
(F,24,89000.0,95101)
(M,80,92000.0,95051)
(F,30,83000.0,95102)
(F,35,86000.0,95051)
(M,69,82000.0,95102)
(F,49,83000.0,95105)
(M,59,82000.0,95103)
(F,74,84000.0,95103)
(F,82,83000.0,95051)
(M,32,85000.0,95102)
(M,39,91000.0,95103)
(M,50,95000.0,95051)
(M,98,89000.0,95105)
(M,84,96000.0,95050)
(M,61,90000.0,95103)
(F,69,83000.0,95102)
(F,59,91000.0,95101)
(M,79,90000.0,95050)
(F,98,83000.0,95050)
(F,65,78000.0,94040)
(F,74,81000.0,95103)
(M,83,97000.0,95101)
(M,42,92000.0,95102)
(M,82,92000.0,95105)
(F,41,91000.0,94041)
(F,35,97000.0,94040)
(F,46,85000.0,95050)
(M,34,86000.0,94041)
(F,37,85000.0,94041)
(M,64,91000.0,94040)
(M,92,84000.0,95051)
(M,56,83000.0,95103)
(F,68,98000.0,95101)
(M,28,81000.0,95050)
(F,81,93000.0,95050)
(M,71,87000.0,95051)
(M,90,86000.0,95050)
(F,92,78000.0,94041)
(M,42,97000.0,95101)
(F,97,83000.0,94041)
(M,41,86000.0,95051)
(F,96,99000.0,95102)
(F,56,96000.0,95051)
(F,63,99000.0,95105)
(F,69,89000.0,95050)
(M,67,85000.0,95105)
(M,61,83000.0,95051)
(M,86,96000.0,95103)
(F,84,82000.0,94041)
(M,91,90000.0,95050)
(F,36,99000.0,94041)
(M,75,97000.0,95105)
(M,39,93000.0,95050)
(M,56,90000.0,95050)
(M,61,91000.0,95105)
(M,29,93000.0,94041)
(M,79,99000.0,95102)
(M,48,91000.0,95101)
(F,95,76000.0,95101)
(M,47,98000.0,95050)
(M,61,88000.0,95101)
(M,74,77000.0,95101)
(M,75,83000.0,94040)
(M,34,82000.0,95103)
(M,70,85000.0,95103)
(F,43,94000.0,94041)
(F,64,91000.0,95105)
(F,21,95000.0,95051)
(M,55,91000.0,95051)
(M,27,85000.0,95105)
(F,40,84000.0,94040)
(F,41,84000.0,94041)
(F,50,87000.0,95051)
(M,72,82000.0,95103)
(F,50,87000.0,95105)
(F,31,93000.0,95102)
(F,45,80000.0,95050)
(F,62,77000.0,94040)
(M,93,91000.0,95101)
(M,77,94000.0,95051)
(F,33,82000.0,95051)
(M,95,87000.0,95105)
(M,40,79000.0,95102)
(M,82,87000.0,95050)
(M,55,85000.0,95051)
(M,52,96000.0,95102)
(F,52,96000.0,95050)
(F,78,82000.0,95102)
(F,31,82000.0,94041)
(F,60,97000.0,95101)
(M,77,81000.0,95102)
(F,78,93000.0,95101)
(M,74,82000.0,94040)
(M,62,77000.0,95050)
(F,72,77000.0,95102)
(M,96,87000.0,94041)
(F,89,93000.0,95051)
(M,59,87000.0,95050)
(F,26,81000.0,95105)
(F,84,77000.0,95051)
(F,42,84000.0,94040)
(F,59,96000.0,94041)
(F,31,78000.0,95050)
(F,91,85000.0,95105)
(F,87,79000.0,95102)
(M,39,88000.0,95105)
(F,47,86000.0,95051)
(F,24,92000.0,95101)
(F,76,85000.0,95103)
(F,48,83000.0,95105)
(M,50,88000.0,95105)
(F,61,93000.0,94041)
(F,59,98000.0,95050)
(F,57,95000.0,95050)
(M,77,76000.0,95105)
(M,34,90000.0,95105)
(M,23,91000.0,95050)
(M,38,88000.0,95051)
(F,35,86000.0,95102)
(M,27,91000.0,95103)
(F,99,78000.0,95051)
(F,77,94000.0,94041)
(M,23,83000.0,95103)
(M,93,91000.0,95051)
(F,94,89000.0,95103)
(M,99,99000.0,95105)
(M,75,84000.0,94040)
(M,32,89000.0,94041)
(F,57,76000.0,94040)
(F,94,95000.0,95103)
(M,66,82000.0,94041)
(F,56,98000.0,94041)
(M,37,88000.0,95105)
(M,89,82000.0,95050)
(M,91,79000.0,95103)
(F,72,90000.0,95102)
(F,53,85000.0,95050)
(F,87,91000.0,95105)
(M,74,91000.0,95050)
(F,62,99000.0,95102)
(M,46,95000.0,95105)
(F,73,78000.0,95050)
(F,35,94000.0,95102)
(F,60,77000.0,95105)
(M,83,93000.0,95105)
(F,55,76000.0,95051)
(F,36,90000.0,95101)
(F,75,87000.0,95103)
(F,91,98000.0,95103)
(F,66,87000.0,95101)
(M,83,91000.0,95103)
(M,52,77000.0,94040)
(F,76,85000.0,95103)
(F,98,78000.0,95102)
(F,60,89000.0,95050)
(F,30,76000.0,95101)
(F,53,95000.0,95050)
(M,63,85000.0,95105)
(F,25,94000.0,95050)
(M,29,98000.0,95103)
(M,53,82000.0,95050)
(F,70,89000.0,95101)
(F,76,83000.0,95105)
(M,85,98000.0,95050)
(F,81,97000.0,95103)
(M,30,77000.0,94041)
(F,73,85000.0,95102)
(M,94,93000.0,95103)
(F,83,80000.0,95101)
(F,44,88000.0,94040)
(F,35,83000.0,95051)
(F,25,82000.0,94040)
(M,26,92000.0,95101)
(F,60,81000.0,95105)
(F,47,78000.0,94040)
(F,53,87000.0,94040)
(F,44,88000.0,95051)
(M,73,96000.0,95103)
(F,77,95000.0,95103)
(M,24,93000.0,95050)
(F,21,76000.0,95050)
(F,82,90000.0,95103)
(M,71,97000.0,95051)
(M,53,79000.0,95105)
(M,28,84000.0,94040)
(M,35,97000.0,95101)
(F,75,76000.0,94040)
(M,87,94000.0,94041)
(F,89,79000.0,95102)
(F,80,92000.0,95102)
(M,24,77000.0,95102)
(F,40,94000.0,95105)
(M,43,80000.0,94041)
(M,23,80000.0,94041)
(F,51,83000.0,94041)
(F,90,78000.0,94040)
(F,41,79000.0,95102)
(M,48,93000.0,94041)
(M,69,94000.0,94040)
(F,36,81000.0,95101)
(M,35,91000.0,95051)
(F,26,88000.0,95050)
(M,35,83000.0,94041)
(F,36,77000.0,95103)
(M,57,91000.0,95103)
(F,57,89000.0,95101)
(F,38,86000.0,94041)
(F,31,83000.0,95050)
(M,47,96000.0,94041)
(F,91,83000.0,95101)
(F,21,78000.0,95103)
(M,32,84000.0,95051)
(F,41,93000.0,94041)
(M,81,93000.0,95102)
(F,59,78000.0,95105)
(M,71,90000.0,95050)
(F,51,77000.0,95051)
(M,29,88000.0,95102)
(F,40,93000.0,95102)
(F,89,99000.0,95105)
(F,64,77000.0,95103)
(F,53,87000.0,94041)
(M,53,97000.0,94040)
(M,45,78000.0,94040)
(F,76,89000.0,94041)
(M,59,81000.0,95050)
(F,24,76000.0,94041)
(M,72,95000.0,95051)
(M,63,83000.0,94040)
(F,39,76000.0,94041)
(F,26,85000.0,95101)
(M,90,99000.0,95102)
(F,47,76000.0,95103)
(M,72,86000.0,95105)
(M,38,92000.0,95050)
(M,54,78000.0,95101)
(F,48,86000.0,95102)
(F,37,78000.0,94040)
(F,75,88000.0,95103)
(F,66,78000.0,95050)
(M,58,80000.0,94040)
(M,84,88000.0,95050)
(F,35,94000.0,95050)
(M,57,88000.0,95102)
(M,68,83000.0,95050)
(M,37,91000.0,95103)
(M,65,79000.0,95101)
(M,65,85000.0,95101)
(F,97,83000.0,95102)
(M,43,83000.0,95051)
(F,73,82000.0,95103)
(M,89,87000.0,95050)
(F,74,84000.0,95103)
(M,73,90000.0,94041)
(F,46,97000.0,95103)
(M,36,82000.0,94041)
(M,80,82000.0,95105)
(F,78,79000.0,95102)
(M,67,96000.0,94040)
(F,48,98000.0,95102)
(F,82,86000.0,95050)
(M,79,80000.0,95050)
(M,96,84000.0,95103)
(M,51,87000.0,94040)
(F,29,84000.0,95051)
(M,47,86000.0,94040)
(M,54,96000.0,94041)
(F,80,94000.0,94041)
(F,92,93000.0,95103)
(F,59,79000.0,95050)
(M,95,80000.0,95050)
(M,67,92000.0,94040)
(F,23,98000.0,95103)
(M,91,82000.0,95051)
(M,27,89000.0,95105)
(M,43,77000.0,94041)
(F,65,83000.0,94040)
(F,65,82000.0,95051)
(M,43,98000.0,95105)
(F,51,86000.0,95102)
(M,76,83000.0,95051)
(F,25,92000.0,94040)
(M,48,76000.0,95102)
(F,43,86000.0,95050)
(F,57,83000.0,95101)
(F,48,84000.0,95051)
(M,37,98000.0,95102)
(F,98,81000.0,95105)
(M,78,86000.0,94041)
(F,34,93000.0,95102)
(M,53,94000.0,95102)
(M,69,98000.0,94040)
(F,70,84000.0,94041)
(F,89,87000.0,94040)
(F,52,89000.0,95102)
(F,84,79000.0,95102)
(M,44,86000.0,94041)
(M,51,93000.0,94041)
(M,98,81000.0,95102)
(F,82,77000.0,95101)
(M,50,82000.0,95103)
(F,59,76000.0,95051)
(M,29,76000.0,94041)
(F,30,81000.0,95051)
(F,22,96000.0,95105)
(M,64,88000.0,94040)
(M,80,78000.0,95102)
(F,94,85000.0,95051)
(M,63,95000.0,95103)
(F,51,78000.0,95050)
(M,39,94000.0,95105)
(M,80,85000.0,95101)
(M,92,89000.0,95102)
(M,44,88000.0,95103)
(M,57,92000.0,95050)
(F,64,94000.0,95051)
(F,88,91000.0,95102)
(F,43,83000.0,95101)
(F,33,93000.0,95050)
(M,64,92000.0,95102)
(M,91,92000.0,95050)
(F,32,88000.0,95105)
(M,78,87000.0,94041)
(F,64,85000.0,94040)
(M,93,96000.0,95102)
(F,72,98000.0,95103)
(M,68,76000.0,95051)
(M,52,95000.0,95050)
(F,75,93000.0,95103)
(M,45,85000.0,94041)
(F,70,98000.0,95051)
(F,74,96000.0,95101)
(F,81,85000.0,95102)
(M,83,91000.0,95105)
(M,32,89000.0,95101)
(F,58,90000.0,94041)
(M,55,80000.0,95050)
(F,23,79000.0,95051)
(M,91,79000.0,95103)
(F,21,98000.0,95102)
(F,57,91000.0,95101)
(M,58,91000.0,95051)
(F,41,94000.0,95101)
(M,67,95000.0,94041)
(M,69,80000.0,95101)
(M,23,77000.0,94041)
(F,94,92000.0,95105)
(F,60,92000.0,95051)
(F,53,84000.0,94041)
(F,48,98000.0,95103)
(M,70,88000.0,95051)
(M,76,94000.0,95103)
(F,22,88000.0,94040)
(F,80,81000.0,95102)
(F,57,80000.0,95051)
(F,57,99000.0,95103)
(M,50,78000.0,95050)
(M,40,81000.0,95050)
(F,93,97000.0,95050)
(M,40,80000.0,94041)
(M,35,91000.0,95101)
(F,50,96000.0,94041)
(F,27,90000.0,95105)
(F,23,91000.0,95105)
(M,49,80000.0,94041)
(M,90,98000.0,95105)
(M,29,91000.0,95050)
(F,99,83000.0,95103)
(F,43,83000.0,94040)
(F,30,90000.0,94041)
(F,96,97000.0,95102)
(M,83,77000.0,95103)
(F,77,97000.0,94040)
(F,74,98000.0,95105)
(F,96,96000.0,95103)
(F,37,81000.0,94041)
(M,82,91000.0,94040)
(F,33,90000.0,95101)
(F,35,86000.0,95102)
(F,67,87000.0,95105)
(M,95,95000.0,95051)
(M,82,95000.0,95101)
(F,26,76000.0,95050)
(F,65,84000.0,95103)
(F,34,91000.0,95102)
(F,48,81000.0,94040)
(F,93,84000.0,94041)
(F,37,79000.0,95105)
(M,77,84000.0,95102)
(M,94,78000.0,94040)
(M,28,79000.0,95051)
(F,30,80000.0,94041)
(F,54,80000.0,95103)
(F,93,96000.0,95105)
(F,45,78000.0,94041)

现在我正在执行 pig 命令。我想在执行时直接或复制输出 让它真的很难拍下来。 只是提出一个克服它的解决方案。

代码说明命令的输出

grunt>salaries= load 'salaries' using PigStorage(',') As (gender, age,salary,zip);
grunt> salaries= load 'salaries' using PigStorage(',') As (gender:chararray,age:int,salary:double,zip:long);
grunt>highsal= filter salaries by salary > 75000;
grunt>dump highsal;

当执行上述命令时,将显示上面的输出列表。 我刚从本地 FS 复制 salaries.txt 到 hdfs .

grunt> store highsal into 'file';
2015-09-24 02:59:15,981 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: Pig script failed to parse: 
<line 1, column 6> Undefined alias: highsal
Details at logfile: /home/vivek/pig_1443088724224.log
grunt> 

我仍然收到建议查询的错误。

store highsal into 'file';

查看所有命令的 apache pig 文档。

您在尝试 运行 STORE 命令时没有定义 "highsal" 别名。 Pig 不存储任何别名以前的会话。您必须在一个会话中执行所有命令或编写猪脚本并调用它。

试一试:

grunt>salaries= load 'salaries' using PigStorage(',') As (gender, age,salary,zip);
grunt> salaries= load 'salaries' using PigStorage(',') As (gender:chararray,age:int,salary:double,zip:long);
grunt>highsal= filter salaries by salary > 75000;
grunt>STORE highsal INTO 'file';

这会将 "highsal" 内容存储在用户 HDFS 目录中的文件名 'file/part-x-xxxxx' 中。如果您希望将数据存储在用户主目录

以外的目录中,您还可以提供 HDFS 绝对目录路径而不是 'file'

希望对您有所帮助