{"id":716,"date":"2016-11-08T12:04:24","date_gmt":"2016-11-08T12:04:24","guid":{"rendered":"http:\/\/thejoyofstick.com\/blog\/?p=716"},"modified":"2016-11-08T15:23:20","modified_gmt":"2016-11-08T15:23:20","slug":"look-out-if-you-process-cisco-ios-xr-configuration-files","status":"publish","type":"post","link":"https:\/\/thejoyofstick.com\/blog\/2016\/11\/08\/look-out-if-you-process-cisco-ios-xr-configuration-files\/","title":{"rendered":"Lookout if you process Cisco IOS-XR configuration files"},"content":{"rendered":"<p>I lost too much time just doing a simple script: checking for a <code>class-map<\/code> configuration across several backup configuration files. And it never matched!<\/p>\n<p>The problem should be with me or my script as I knew it was all ok on some of the files.<\/p>\n<p>However after bouncing my head several times I found the issue.<\/p>\n<p><b>Some of the configuration has trailing spaces at the end of the line!<\/b><\/p>\n<p>At first I thought it was may be a problem with <a href=\"http:\/\/www.shrubbery.net\/rancid\/\" target=\"_blank\">RANCID<\/a>. But it was not.<\/p>\n<p>To make this visible I just issued something like this at the router prompt<\/p>\n<pre lang=\"cisco\">sh run | b ^class-map match-any CORE-VOICE\r\n<\/pre>\n<p>And <i>copy-pasted<\/i> some lines to vim that gave me this<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-717 size-full\" src=\"https:\/\/thejoyofstick.com\/blog\/wp-content\/uploads\/2016\/11\/lapa-_594-e1478605866356.png\" alt=\"ios-xr-with-trailing-spaces\" width=\"640\" height=\"383\" \/><\/p>\n<p>The red squares show that there are spaces at the end of two lines!<\/p>\n<p>It&#8217;s a nice feature to have active on vim. Just add these two lines to your <code>~\/.vimrc<\/code><\/p>\n<pre lang=\"vim\">\r\nhighlight ExtraWhitespace ctermbg=red guibg=red\r\nmatch ExtraWhitespace \/\\s\\+$\/\r\n<\/pre>\n<p>So, next time you have to chew some IOS-XR configurations files don&#8217;t forget to right trim all those lines!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I lost too much time just doing a simple script: checking for a class-map configuration across several backup configuration files. And it never matched! The problem should be with me or my script as I knew it was all ok&hellip; <a href=\"https:\/\/thejoyofstick.com\/blog\/2016\/11\/08\/look-out-if-you-process-cisco-ios-xr-configuration-files\/\" class=\"more-link\">Continue Reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[13],"tags":[66,41],"class_list":["post-716","post","type-post","status-publish","format-standard","hentry","category-network","tag-cisco","tag-vim"],"jetpack_shortlink":"https:\/\/wp.me\/pcmwlL-by","jetpack_sharing_enabled":true,"jetpack_likes_enabled":false,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/posts\/716","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/comments?post=716"}],"version-history":[{"count":9,"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/posts\/716\/revisions"}],"predecessor-version":[{"id":726,"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/posts\/716\/revisions\/726"}],"wp:attachment":[{"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/media?parent=716"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/categories?post=716"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/tags?post=716"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}