output formatting of shell script - mysql

The name of the pictureThe name of the pictureThe name of the pictureClash 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`; |






share|improve this question
























    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`; |






    share|improve this question






















      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`; |






      share|improve this question












      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`; |








      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 10 at 18:22









      user3508766

      447




      447




















          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





          share|improve this answer
















          • 1




            worked like a charm. Thanks
            – user3508766
            Apr 10 at 18:30










          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
          );



          );








           

          draft saved


          draft discarded


















          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






























          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





          share|improve this answer
















          • 1




            worked like a charm. Thanks
            – user3508766
            Apr 10 at 18:30














          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





          share|improve this answer
















          • 1




            worked like a charm. Thanks
            – user3508766
            Apr 10 at 18:30












          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





          share|improve this answer












          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






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 10 at 18:24









          DopeGhoti

          40.1k54779




          40.1k54779







          • 1




            worked like a charm. Thanks
            – user3508766
            Apr 10 at 18:30












          • 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












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          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













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?