output formatting of shell script - mysql
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
When I run this script
mysql -e "use sentry;
select DISTINCT
concat(
'CREATE ROLE `',
r.ROLE_NAME,
'`;')
from
SENTRY_ROLE r
join SENTRY_ROLE_DB_PRIVILEGE_MAP rp on rp.ROLE_ID = r.ROLE_ID
join SENTRY_DB_PRIVILEGE p on p.DB_PRIVILEGE_ID = rp.DB_PRIVILEGE_ID
;" -u mysql_sel -p$Pass
I get output of
+---------------------------------------------------------+
| concat(
'CREATE ROLE `',
r.ROLE_NAME,
'`;') |
+---------------------------------------------------------+
| CREATE ROLE `admin_role`; |
How can I get output of only
+---------------------------------------------------------+
| CREATE ROLE `admin_role`; |
linux bash mysql
add a comment |Â
up vote
0
down vote
favorite
When I run this script
mysql -e "use sentry;
select DISTINCT
concat(
'CREATE ROLE `',
r.ROLE_NAME,
'`;')
from
SENTRY_ROLE r
join SENTRY_ROLE_DB_PRIVILEGE_MAP rp on rp.ROLE_ID = r.ROLE_ID
join SENTRY_DB_PRIVILEGE p on p.DB_PRIVILEGE_ID = rp.DB_PRIVILEGE_ID
;" -u mysql_sel -p$Pass
I get output of
+---------------------------------------------------------+
| concat(
'CREATE ROLE `',
r.ROLE_NAME,
'`;') |
+---------------------------------------------------------+
| CREATE ROLE `admin_role`; |
How can I get output of only
+---------------------------------------------------------+
| CREATE ROLE `admin_role`; |
linux bash mysql
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
When I run this script
mysql -e "use sentry;
select DISTINCT
concat(
'CREATE ROLE `',
r.ROLE_NAME,
'`;')
from
SENTRY_ROLE r
join SENTRY_ROLE_DB_PRIVILEGE_MAP rp on rp.ROLE_ID = r.ROLE_ID
join SENTRY_DB_PRIVILEGE p on p.DB_PRIVILEGE_ID = rp.DB_PRIVILEGE_ID
;" -u mysql_sel -p$Pass
I get output of
+---------------------------------------------------------+
| concat(
'CREATE ROLE `',
r.ROLE_NAME,
'`;') |
+---------------------------------------------------------+
| CREATE ROLE `admin_role`; |
How can I get output of only
+---------------------------------------------------------+
| CREATE ROLE `admin_role`; |
linux bash mysql
When I run this script
mysql -e "use sentry;
select DISTINCT
concat(
'CREATE ROLE `',
r.ROLE_NAME,
'`;')
from
SENTRY_ROLE r
join SENTRY_ROLE_DB_PRIVILEGE_MAP rp on rp.ROLE_ID = r.ROLE_ID
join SENTRY_DB_PRIVILEGE p on p.DB_PRIVILEGE_ID = rp.DB_PRIVILEGE_ID
;" -u mysql_sel -p$Pass
I get output of
+---------------------------------------------------------+
| concat(
'CREATE ROLE `',
r.ROLE_NAME,
'`;') |
+---------------------------------------------------------+
| CREATE ROLE `admin_role`; |
How can I get output of only
+---------------------------------------------------------+
| CREATE ROLE `admin_role`; |
linux bash mysql
asked Apr 10 at 18:22
user3508766
447
447
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Use mysql -N
to skip column names on the output ASCII table. To use your command line as an example:
mysql -N -e "use sentry;
select DISTINCT
concat(
'CREATE ROLE `',
r.ROLE_NAME,
'`;')
from
SENTRY_ROLE r
join SENTRY_ROLE_DB_PRIVILEGE_MAP rp on rp.ROLE_ID = r.ROLE_ID
join SENTRY_DB_PRIVILEGE p on p.DB_PRIVILEGE_ID = rp.DB_PRIVILEGE_ID
;" -u mysql_sel -p$Pass
1
worked like a charm. Thanks
â user3508766
Apr 10 at 18:30
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Use mysql -N
to skip column names on the output ASCII table. To use your command line as an example:
mysql -N -e "use sentry;
select DISTINCT
concat(
'CREATE ROLE `',
r.ROLE_NAME,
'`;')
from
SENTRY_ROLE r
join SENTRY_ROLE_DB_PRIVILEGE_MAP rp on rp.ROLE_ID = r.ROLE_ID
join SENTRY_DB_PRIVILEGE p on p.DB_PRIVILEGE_ID = rp.DB_PRIVILEGE_ID
;" -u mysql_sel -p$Pass
1
worked like a charm. Thanks
â user3508766
Apr 10 at 18:30
add a comment |Â
up vote
1
down vote
accepted
Use mysql -N
to skip column names on the output ASCII table. To use your command line as an example:
mysql -N -e "use sentry;
select DISTINCT
concat(
'CREATE ROLE `',
r.ROLE_NAME,
'`;')
from
SENTRY_ROLE r
join SENTRY_ROLE_DB_PRIVILEGE_MAP rp on rp.ROLE_ID = r.ROLE_ID
join SENTRY_DB_PRIVILEGE p on p.DB_PRIVILEGE_ID = rp.DB_PRIVILEGE_ID
;" -u mysql_sel -p$Pass
1
worked like a charm. Thanks
â user3508766
Apr 10 at 18:30
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Use mysql -N
to skip column names on the output ASCII table. To use your command line as an example:
mysql -N -e "use sentry;
select DISTINCT
concat(
'CREATE ROLE `',
r.ROLE_NAME,
'`;')
from
SENTRY_ROLE r
join SENTRY_ROLE_DB_PRIVILEGE_MAP rp on rp.ROLE_ID = r.ROLE_ID
join SENTRY_DB_PRIVILEGE p on p.DB_PRIVILEGE_ID = rp.DB_PRIVILEGE_ID
;" -u mysql_sel -p$Pass
Use mysql -N
to skip column names on the output ASCII table. To use your command line as an example:
mysql -N -e "use sentry;
select DISTINCT
concat(
'CREATE ROLE `',
r.ROLE_NAME,
'`;')
from
SENTRY_ROLE r
join SENTRY_ROLE_DB_PRIVILEGE_MAP rp on rp.ROLE_ID = r.ROLE_ID
join SENTRY_DB_PRIVILEGE p on p.DB_PRIVILEGE_ID = rp.DB_PRIVILEGE_ID
;" -u mysql_sel -p$Pass
answered Apr 10 at 18:24
DopeGhoti
40.1k54779
40.1k54779
1
worked like a charm. Thanks
â user3508766
Apr 10 at 18:30
add a comment |Â
1
worked like a charm. Thanks
â user3508766
Apr 10 at 18:30
1
1
worked like a charm. Thanks
â user3508766
Apr 10 at 18:30
worked like a charm. Thanks
â user3508766
Apr 10 at 18:30
add a comment |Â
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%2f436838%2foutput-formatting-of-shell-script-mysql%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