How can I remove the number after switch name?

  • 0
  • 2
  • Question
  • Updated 3 years ago
  • Answered
I have connected to the switch using a telnet session. The prompt that I have looks something like this:

    switchName.1 #

After issuing a command the number right after the switch name increments. So the prompt is:

     switchName.2 #

For different reasons I don't want to see that number. Is there a way I could remove that number?
Photo of Ali Askari

Ali Askari

  • 272 Points 250 badge 2x thumb

Posted 3 years ago

  • 0
  • 2
Photo of Jairo Rojas Herrera

Jairo Rojas Herrera

  • 1,452 Points 1k badge 2x thumb
Are the number of commands you've executed on the switch.
Photo of Ali Askari

Ali Askari

  • 272 Points 250 badge 2x thumb
Yes, I know what those numbers represent. But I don't want to see it. I know exactly how many commands I've executed. 
Photo of Stephen Williams

Stephen Williams, Employee

  • 9,034 Points 5k badge 2x thumb
Currently there is no way to remove it.  Sorry
Photo of Henrique

Henrique, Employee

  • 10,302 Points 10k badge 2x thumb
Hi Ali,

When you login into the switch it starts with #1 that represents the next CLI number/position in history buffer.

As far as I know there is no CLI to clear or disable this counter.

If you logout/login you can get the initial value #1
Photo of Ali Askari

Ali Askari

  • 272 Points 250 badge 2x thumb
Hi Henrique,

Thanks. Yes, I figured it out but I was hoping there is an easier way.
Photo of Drew C.

Drew C., Community Manager

  • 39,430 Points 20k badge 2x thumb
Hi Ali,
Welcome to The Hub!

Unfortunately, there is no way to disable the command count on the CLI.
Photo of Rodrigo Azevedo

Rodrigo Azevedo

  • 160 Points 100 badge 2x thumb
It's not necessary remove this number..
Photo of Dorian Perry

Dorian Perry, Employee

  • 2,300 Points 2k badge 2x thumb
Hi Ali,

I want to point out that if you need to remove the number for scripting purposes, a regular expression could be used to detect the prompt and avoid conflicts due to the changing number.
(Edited)
Photo of Ali Askari

Ali Askari

  • 272 Points 250 badge 2x thumb
Hi Dorian,

That's why I need to remove it. I am not familiar with regular expression. How can I do it in C++?
Photo of Dorian Perry

Dorian Perry, Employee

  • 2,300 Points 2k badge 2x thumb
I believe this will do it:

std::regex re("switchName.[0-9]+\s#");
(Edited)