Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Sqoop >> mail # user >> Sqoop eval function


+
yogesh kumar 2013-12-30, 10:09
+
Abraham Elmahrek 2013-12-30, 21:17
+
Abraham Elmahrek 2013-12-30, 21:25
+
yogesh kumar 2013-12-31, 10:17
+
Abraham Elmahrek 2013-12-31, 18:24
+
yogesh kumar 2014-01-08, 12:03
Copy link to this message
-
Re: Sqoop eval function
Could you try grep -Po '\d+' instead?
On Wed, Jan 8, 2014 at 4:03 AM, yogesh kumar <[EMAIL PROTECTED]> wrote:

> Hello Abe,
>
> the query
>
>  VAR=$(sqoop-eval
> --query "select max(Salary) from emp..." \
> --username ${user} \
> --password ${Pass} \
> | tee --append ${SQOOP_LOG} | awk '/([0-9]+)/{print $2}')
>
> some time give output like "| 201144  "
>
> say echo $VAR
> o/p >   | 201144
>
> I want to remove the unwanted character and a space "| " , could you pls
> suggest how to trim this and get proper value into a variable i.e 201144
>
> pls suggest
>
> Thanks & Regards
> Yogesh Kumar
>
>
>
>
> On Tue, Dec 31, 2013 at 11:54 PM, Abraham Elmahrek <[EMAIL PROTECTED]>wrote:
>
>> Hey user,
>>
>> You should be able to use the "tee" command for something like that.
>>
>>  VAR=$(sqoop-eval
>> --query "select max(Salary) from emp..." \
>> --username ${user} \
>> --password ${Pass} \
>> | tee --append ${SQOOP_LOG} | awk '/([0-9]+)/{print $2}')
>>
>> -Abe
>>
>>
>> On Tue, Dec 31, 2013 at 2:17 AM, yogesh kumar <[EMAIL PROTECTED]>wrote:
>>
>>> Thanks Abe.
>>>
>>> I have tried this
>>>
>>>    VAR=$(sqoop-eval
>>> --query "select max(Salary) from emp..." \
>>> --username ${user} \
>>> --password ${Pass} \
>>> >> ${SQOOP_LOG} 2>&1 | awk '/([0-9]+)/{print $2}')
>>>
>>> echo "The vale of VAR is "
>>> echo $VAR
>>>
>>> It dosen't store the vale into VAR, It shows it into a Log file i have
>>> used by passing through a config file
>>>
>>> *In here If if do remove  " >> ${SQOOP_LOG} 2>&1 "  it shows the result
>>> and store the value into VAR but also the messages from sqoop to the
>>> consol.*
>>> I put all sqoop messages in a log file by using this .
>>>
>>> I was trying to put sqoop messages into a file and the result into a
>>> VAR,
>>>
>>> Pls suggest whats I am missing here or how to get it
>>>
>>> Many thanks in advance and a very happy new year
>>>
>>> Thanks
>>> Yogesh
>>>
>>>
>>>
>>>  On Tue, Dec 31, 2013 at 2:55 AM, Abraham Elmahrek <[EMAIL PROTECTED]>wrote:
>>>
>>>> Sorry,
>>>>
>>>> To be more clear... you should be able to do something like:
>>>>
>>>> MYVAL=$(sqoop-eval -query "SELECT COUNT(*) FROM test" ... |  awk
>>>> '/([0-9]+)/{print $2}')
>>>>
>>>> or
>>>>
>>>> MYVAL=$(sqoop-eval -query "SELECT COUNT(*) FROM test" ... |  grep -Po
>>>> "\d+")
>>>>
>>>> -Abe
>>>>
>>>>
>>>> On Mon, Dec 30, 2013 at 1:17 PM, Abraham Elmahrek <[EMAIL PROTECTED]>wrote:
>>>>
>>>>> Hey There,
>>>>>
>>>>> The Sqoop eval command is more for verification and preview purposes
>>>>> than actual usage. With that being said... you can definitely pipe the
>>>>> result of sqoop eval into a file and perform what ever formatting you see
>>>>> fit (ie with AWK).
>>>>>
>>>>> -Abe
>>>>>
>>>>>
>>>>> On Mon, Dec 30, 2013 at 2:09 AM, yogesh kumar <[EMAIL PROTECTED]>wrote:
>>>>>
>>>>>> Hello all,
>>>>>>
>>>>>> I am doing some select operation with sqoop evel function. like
>>>>>>
>>>>>> sqoop eval -libjars ..
>>>>>> --query "select max(salary) from employe where dept = HR"
>>>>>> -- username abc
>>>>>> --password abc
>>>>>>
>>>>>>
>>>>>> Its working fine, I want to store the result of this query into a
>>>>>> unix shell script variable..
>>>>>>  for using this vale for further operations...
>>>>>>
>>>>>>
>>>>>> Pls help and suggest how to stroe the value into a vriable.
>>>>>>
>>>>>> Thanks & Regards
>>>>>> Yogesh Kumar
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>