Thursday, March 19, 2009

Copy paste '?' characters on Cisco IOS CLI

The Cisco IOS command line interface (CLI) has the special character '?' which you cannot insert into a literal string. One method of doing that is to do a and then type '?' (without the quotes) and then the special character gets inserted in the string.

However, when you are copy-pasting IOS CLI commands, it might be tough. The simplest way is to open the file in vim and just do this:
:%s/?/Control-V Control-V?/g
which will add the special escape character "Control V" in front of every question mark.

The other method (for all you Windows Notepad folks) is to copy paste the character in the next line:

without the trailing newline and do a search and replace of every ? with ? in the text file. Then you can copy paste the file.