Use the output of Select in a Table with a script bash

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have a issue.



I build a script can connect to database and select a value from table



But i can't get only the result



this is my script



while IFS='' read -r line || [[ -n "$line" ]]; do
mysql -p<pass-db> -e "select id from test where concat(upper(trim(firstname)), ' ', upper(trim(lastname)))=upper('$line')" mydatanase
echo $IDS[j]
let "j++"
done < employees.txt


the output of echo is



id
78


i would only get the "78" , not the name of colomun










share|improve this question







New contributor




YOU CHT LEE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Hello @YOU CHT LEE is the output of echo only two lines? or a series of lines: Id then number then id after then number and so on ?
    – Goro
    10 mins ago














up vote
0
down vote

favorite












I have a issue.



I build a script can connect to database and select a value from table



But i can't get only the result



this is my script



while IFS='' read -r line || [[ -n "$line" ]]; do
mysql -p<pass-db> -e "select id from test where concat(upper(trim(firstname)), ' ', upper(trim(lastname)))=upper('$line')" mydatanase
echo $IDS[j]
let "j++"
done < employees.txt


the output of echo is



id
78


i would only get the "78" , not the name of colomun










share|improve this question







New contributor




YOU CHT LEE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Hello @YOU CHT LEE is the output of echo only two lines? or a series of lines: Id then number then id after then number and so on ?
    – Goro
    10 mins ago












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a issue.



I build a script can connect to database and select a value from table



But i can't get only the result



this is my script



while IFS='' read -r line || [[ -n "$line" ]]; do
mysql -p<pass-db> -e "select id from test where concat(upper(trim(firstname)), ' ', upper(trim(lastname)))=upper('$line')" mydatanase
echo $IDS[j]
let "j++"
done < employees.txt


the output of echo is



id
78


i would only get the "78" , not the name of colomun










share|improve this question







New contributor




YOU CHT LEE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I have a issue.



I build a script can connect to database and select a value from table



But i can't get only the result



this is my script



while IFS='' read -r line || [[ -n "$line" ]]; do
mysql -p<pass-db> -e "select id from test where concat(upper(trim(firstname)), ' ', upper(trim(lastname)))=upper('$line')" mydatanase
echo $IDS[j]
let "j++"
done < employees.txt


the output of echo is



id
78


i would only get the "78" , not the name of colomun







shell-script






share|improve this question







New contributor




YOU CHT LEE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




YOU CHT LEE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




YOU CHT LEE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 30 mins ago









YOU CHT LEE

11




11




New contributor




YOU CHT LEE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





YOU CHT LEE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






YOU CHT LEE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • Hello @YOU CHT LEE is the output of echo only two lines? or a series of lines: Id then number then id after then number and so on ?
    – Goro
    10 mins ago
















  • Hello @YOU CHT LEE is the output of echo only two lines? or a series of lines: Id then number then id after then number and so on ?
    – Goro
    10 mins ago















Hello @YOU CHT LEE is the output of echo only two lines? or a series of lines: Id then number then id after then number and so on ?
– Goro
10 mins ago




Hello @YOU CHT LEE is the output of echo only two lines? or a series of lines: Id then number then id after then number and so on ?
– Goro
10 mins ago










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Invoke mysql with -N to turn off column headers, i.e. mysql -N





share




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    YOU CHT LEE is a new contributor. Be nice, and check out our Code of Conduct.









     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475639%2fuse-the-output-of-select-in-a-table-with-a-script-bash%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Invoke mysql with -N to turn off column headers, i.e. mysql -N





    share
























      up vote
      0
      down vote













      Invoke mysql with -N to turn off column headers, i.e. mysql -N





      share






















        up vote
        0
        down vote










        up vote
        0
        down vote









        Invoke mysql with -N to turn off column headers, i.e. mysql -N





        share












        Invoke mysql with -N to turn off column headers, i.e. mysql -N






        share











        share


        share










        answered 2 mins ago









        jim mcnamara

        212




        212




















            YOU CHT LEE is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            YOU CHT LEE is a new contributor. Be nice, and check out our Code of Conduct.












            YOU CHT LEE is a new contributor. Be nice, and check out our Code of Conduct.











            YOU CHT LEE is a new contributor. Be nice, and check out our Code of Conduct.













             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475639%2fuse-the-output-of-select-in-a-table-with-a-script-bash%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            Peggy Mitchell

            Palaiologos

            The Forum (Inglewood, California)