I find often myself working with Cisco configuration files that have been offloaded to an FTP or TFTP server. Fortunately Notepad++ is a wonderful tool that will handle these files properly and runs well on Windows. Unfortunately, I don’t always have a copy of Notepad++ at my fingertips. When trying to open an IOS created configuration file in the standard Windows Notepad, an irritating little issue arises. What happens is a formatting issue resulting from the fact that IOS terminates each line with a single “LF”, or “line feed”. This article takes a look at this common IOS Configuration File Formatting and demonstrates a way to resolve it without use of any third-party utilities.
To first demonstrate the problem, I have opened a file that was created in IOS and copied to my laptop using TFTP. The file, as rendered in Windows Notepad, looks like single continual line of text.
Not having a real text editor at my disposal can be a bit of a drag. However, there is a quick way to rectify this without any third-party utilities. The way I typically work around this is using the Windows “find” command. This command seems to interpret the standalone “LF” as the end of a line when it parses the file. This single “LF” is how IOS terminates a line, but Windows Notepad expects a “CR/LF”, or “carriage return” followed by a “line feed”.
Given the fact that “find” can accurately determine the end of line is only part of the challenge. There is also a need to rewrite the file with “CR/LF” at the end of each line so Windows Notepad can properly interpret the file. Fortunately, the “find” command output can be used to create a new text file with the appropriate formatting. Here’s the full syntax I normally use.
find /v "some very random string of text" inputfile.cfg >> outputfile.cfg
By using this syntax, the /v parameter tells “find” to display all lines not containing “some very random string of text”.
Putting this in action with the previous example would look like the following.
find /v "adfasdfkjk" R1.cfg >> R1_out.cfg
Opening R1_out.cfg in notepad looks normal and is much more readable.
IOS devices seem to be able to handle either method of terminating a line. However, these devices produce configuration files that terminate a new line with a single “LF”. The demonstrated method of using the “find” command can be used to resolve IOS Configuration File Formatting issues for Windows users. By using this technique, a file is produced that can be properly rendered in Windows Notepad.