You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by shan s <my...@gmail.com> on 2012/06/13 18:05:38 UTC
How to redirect the Pig script summary to a file
How do I store the pig console output to a file.
pig -x mapred -l logs -param $xyz=1000 pqr.pig >> a.txt does not work for
me. Are there any tricks to make this work?
Or is it available somewhere else.
Thanks, Prashant.
Re: How to redirect the Pig script summary to a file
Posted by Prasanth J <bu...@gmail.com>.
1>a.txt will redirect anything written to System.out to the file. All diagnostic operators, dump statement write to System.out and hence it will be written to a.txt.
Some of the [INFO] messages which you see in the console are from log4j which is configured to print to System.err. Following is extracted from hadoop log4j properties file. So for redirecting both stdout and stderr as prashant pointed out &>a.txt is the way to go.
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.err
Thanks
-- Prasanth J
On Jun 14, 2012, at 1:17 AM, Jonathan Coveney wrote:
> Shan, while Prashant's solution works, why not just have a STORE statement
> to the local filesystem? This is the much cleaner way to do it.
>
> 2012/6/13 shan s <my...@gmail.com>
>
>> It works, thanks.
>> I looked up http://tldp.org/LDP/abs/html/io-redirection.html but still
>> could not figure why your suggestion works.
>>
>> If & is inclusive of 1 & 2, either 1 or 2 should have worked... But 1>a.txt
>> ignores it.
>> Curious..Could you please explain.
>> Thanks!
>> On Thu, Jun 14, 2012 at 3:51 AM, Prashant Kommireddi <prash1784@gmail.com
>>> wrote:
>>
>>> Try
>>>
>>> pig -x mapred -l logs -param $xyz=1000 pqr.pig &>a.txt
>>>
>>> On Wed, Jun 13, 2012 at 9:05 AM, shan s <my...@gmail.com> wrote:
>>>
>>>> How do I store the pig console output to a file.
>>>> pig -x mapred -l logs -param $xyz=1000 pqr.pig >> a.txt does not work
>> for
>>>> me. Are there any tricks to make this work?
>>>> Or is it available somewhere else.
>>>>
>>>> Thanks, Prashant.
>>>>
>>>
>>
Re: How to redirect the Pig script summary to a file
Posted by Jonathan Coveney <jc...@gmail.com>.
Shan, while Prashant's solution works, why not just have a STORE statement
to the local filesystem? This is the much cleaner way to do it.
2012/6/13 shan s <my...@gmail.com>
> It works, thanks.
> I looked up http://tldp.org/LDP/abs/html/io-redirection.html but still
> could not figure why your suggestion works.
>
> If & is inclusive of 1 & 2, either 1 or 2 should have worked... But 1>a.txt
> ignores it.
> Curious..Could you please explain.
> Thanks!
> On Thu, Jun 14, 2012 at 3:51 AM, Prashant Kommireddi <prash1784@gmail.com
> >wrote:
>
> > Try
> >
> > pig -x mapred -l logs -param $xyz=1000 pqr.pig &>a.txt
> >
> > On Wed, Jun 13, 2012 at 9:05 AM, shan s <my...@gmail.com> wrote:
> >
> > > How do I store the pig console output to a file.
> > > pig -x mapred -l logs -param $xyz=1000 pqr.pig >> a.txt does not work
> for
> > > me. Are there any tricks to make this work?
> > > Or is it available somewhere else.
> > >
> > > Thanks, Prashant.
> > >
> >
>
Re: How to redirect the Pig script summary to a file
Posted by shan s <my...@gmail.com>.
It works, thanks.
I looked up http://tldp.org/LDP/abs/html/io-redirection.html but still
could not figure why your suggestion works.
If & is inclusive of 1 & 2, either 1 or 2 should have worked... But 1>a.txt
ignores it.
Curious..Could you please explain.
Thanks!
On Thu, Jun 14, 2012 at 3:51 AM, Prashant Kommireddi <pr...@gmail.com>wrote:
> Try
>
> pig -x mapred -l logs -param $xyz=1000 pqr.pig &>a.txt
>
> On Wed, Jun 13, 2012 at 9:05 AM, shan s <my...@gmail.com> wrote:
>
> > How do I store the pig console output to a file.
> > pig -x mapred -l logs -param $xyz=1000 pqr.pig >> a.txt does not work for
> > me. Are there any tricks to make this work?
> > Or is it available somewhere else.
> >
> > Thanks, Prashant.
> >
>
Re: How to redirect the Pig script summary to a file
Posted by Prashant Kommireddi <pr...@gmail.com>.
Try
pig -x mapred -l logs -param $xyz=1000 pqr.pig &>a.txt
On Wed, Jun 13, 2012 at 9:05 AM, shan s <my...@gmail.com> wrote:
> How do I store the pig console output to a file.
> pig -x mapred -l logs -param $xyz=1000 pqr.pig >> a.txt does not work for
> me. Are there any tricks to make this work?
> Or is it available somewhere else.
>
> Thanks, Prashant.
>