Return-Path: X-Original-To: apmail-hive-user-archive@www.apache.org Delivered-To: apmail-hive-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0CD67973F for ; Wed, 18 Jul 2012 06:31:32 +0000 (UTC) Received: (qmail 25963 invoked by uid 500); 18 Jul 2012 06:31:30 -0000 Delivered-To: apmail-hive-user-archive@hive.apache.org Received: (qmail 25898 invoked by uid 500); 18 Jul 2012 06:31:30 -0000 Mailing-List: contact user-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hive.apache.org Delivered-To: mailing list user@hive.apache.org Received: (qmail 25885 invoked by uid 99); 18 Jul 2012 06:31:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Jul 2012 06:31:30 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FSL_RCVD_USER,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of vinod@vinodsingh.com designates 209.85.214.176 as permitted sender) Received: from [209.85.214.176] (HELO mail-ob0-f176.google.com) (209.85.214.176) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Jul 2012 06:31:22 +0000 Received: by obbtb18 with SMTP id tb18so2231615obb.35 for ; Tue, 17 Jul 2012 23:31:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:x-gm-message-state; bh=p15QU9wdjJ9Zv3I4yPH20G76eJyLPqHeAi0WKPoACDE=; b=VMod9Uq87b+MViOFBKhxuyRSl19KQ8BP4OPcBIKlgm2ejUG3TpY2FC0Vgvh0UYa7V8 mn9mqao0rAm50f6CMojHCFaXGNNhbEc4IbnbH6jPlyijzxnIiaxgM3tSuus6pEkpusL5 NLj49EzAWV44Z0IH+FoiASHovwHWB8fuBTKyUK/fj73B/7EjjJ8xjxDf0OXdVijSWA4b iExZH1FhFdp18H//5QmilzvgEO9kP7lfWKt43NSBcydup8zr4oJl6HPmBvYIYOsCQnla Y+0jWqzicOsySqIH6FuYLCvzVJnS5DZ+dBLd1JCjs/3jrB8E7hPucV7APZyZO+McaooZ cDHw== Received: by 10.182.115.7 with SMTP id jk7mr7506757obb.9.1342593061037; Tue, 17 Jul 2012 23:31:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.74.227 with HTTP; Tue, 17 Jul 2012 23:30:39 -0700 (PDT) In-Reply-To: References: From: Vinod Singh Date: Wed, 18 Jul 2012 12:00:39 +0530 Message-ID: Subject: Re: Run simple HiveQL query using shell script? To: user@hive.apache.org Content-Type: multipart/alternative; boundary=f46d044470b17b253004c514cef7 X-Gm-Message-State: ALoCoQmP0NG3oqskbj75hs7DXbcEzAIm8ccB11aUs9EV8K5ICDfla39z7BUqrPIAG67P3hbsgjVn --f46d044470b17b253004c514cef7 Content-Type: text/plain; charset=UTF-8 hive -e "SELECT count(*) from pds_table" > a.txt Thanks, Vinod On Wed, Jul 18, 2012 at 10:58 AM, Raihan Jamal wrote: > I am new to Unix Shell Scripting world. I wanted to run a simple *HiveQL*query from the Unix Shell script and output the result in a .txt file and > then send that .txt file as an attachment in an email. > > SQL Query and piping the output to a txt file is below: > > SELECT count(*) from pds_table > a.txt; > > How can I do this from a shell script and send the output to a txt file > and then send that txt file as an attachment in an email. > > > *Raihan Jamal* > > --f46d044470b17b253004c514cef7 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable hive -e=C2=A0=C2=A0"SELECT count(*) from pds_table" > a.txt=C2= =A0

Thanks,
Vinod

On Wed, Jul 18, 2012 at 10:58 AM, Raihan Jamal <jamalraihan@gmail.co= m> wrote:
I am new to Unix Shell= Scripting world. I wanted to run a simple HiveQL query from the Uni= x Shell script and output the result in a .txt file and then send that .txt= file as an attachment in an email.

SQL Query and piping the output to a txt file is below:=

=C2=A0 =C2=A0 SELECT count(*) from pds_table >= a.txt;

How can I do this from a shell script and = send the output to a txt file and then send that txt file as an attachment = in an email.=C2=A0


Raihan Jamal


--f46d044470b17b253004c514cef7--