Re: Run asterisk -rx "command" and get plain text output

Jeff LaCoursiere <[email protected]>
Newsgroups gmane.comp.telephony.pbx.asterisk.user
Message-ID <CADBDQjnDdHhxu-L8Fyi9+omOP1otmzRB06nUD2uQmqG-iaA3QA@mail.gmail.com>
Haven't tried this, but try piping through 'strings'

j

On Wed, Aug 3, 2022 at 6:13 PM Carlos Chavez <[email protected]> wrote:

>     The "-n" option only works on startup and cannot be used when Asterisk
> is already running (I tried and I get an error).  We are using version
> 18.12.1.  The output I want to capture is:
>
> asterisk -rx "queue show"
>
>     If I capture the output to a file or straight to the command line I
> get the colorized output.
>
>     I found a way to strip the ANSI codes using SED:
>
> asterisk -rx "queue show" | sed -e 's/\x1b\[[0-9;]*m//g'
>
>
> On 8/3/2022 10:35 AM, Joel Serrano wrote:
>
> Have you tried adding “-n”?
>
> Also, what version of asterisk are you using? newer versions only have
> colorized output when your are connected to the console (-r) not for remote
> commands (-rx)
>
>
>
> On Wed, Aug 3, 2022 at 08:21 Carlos Chavez <[email protected]> wrote:
>
>>      I usually like to have the colorized output when looking at
>> asterisk output but I need to get some info by running "asterisk -rx"
>> and get just plain text output so I can mail it.  Right now I get ANSI
>> codes in the output.  Is there a way to get plain text output for just
>> that script and not disable colors for everything?
>>
>> --
>> Telecomunicaciones Abiertas de México S.A. de C.V.
>> Carlos Chávez
>> +52 (55)8116-9161
>>
>>
>> --
>> _____________________________________________________________________
>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>
>> Check out the new Asterisk community forum at:
>> https://community.asterisk.org/
>>
>> New to Asterisk? Start here:
>>       https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>>
>> asterisk-users mailing list
>> To UNSUBSCRIBE or update options visit:
>>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
> --
> Telecomunicaciones Abiertas de México S.A. de C.V.
> Carlos Chávez
> +52 (55)8116-9161
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at:
> https://community.asterisk.org/
>
> New to Asterisk? Start here:
>       https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
      https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.