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

Clash 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
shell-script
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.
add a comment |Â
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
shell-script
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 ofechoonly two lines? or a series of lines: Id then number then id after then number and so on ?
â Goro
10 mins ago
add a comment |Â
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
shell-script
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
shell-script
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.
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 ofechoonly two lines? or a series of lines: Id then number then id after then number and so on ?
â Goro
10 mins ago
add a comment |Â
Hello @YOU CHT LEE is the output ofechoonly 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
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
Invoke mysql with -N to turn off column headers, i.e. mysql -N
add a comment |Â
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
add a comment |Â
up vote
0
down vote
Invoke mysql with -N to turn off column headers, i.e. mysql -N
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Invoke mysql with -N to turn off column headers, i.e. mysql -N
Invoke mysql with -N to turn off column headers, i.e. mysql -N
answered 2 mins ago
jim mcnamara
212
212
add a comment |Â
add a comment |Â
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.
YOU CHT LEE is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Hello @YOU CHT LEE is the output of
echoonly two lines? or a series of lines: Id then number then id after then number and so on ?â Goro
10 mins ago