redirect results from sh command to text file

Answered Question
Sep 15th, 2010
User Badges:

Hello expert,

I using putty software to access my router.

I would like to copy the result of SH POLICY-MAP INT to a text file for analysis.

The problem I encounter is the display is beyond the screen hence I have to press space bar for further display.

Is there a way I can execute the SH POLICY-MAP INT and redirect the output a text file or remove the more prompt found below the result page.

Regards

Jomo

Correct Answer by Lei Tian about 6 years 8 months ago

Try 'show policy-map int | redirect tftp://x.x.x.x/policy-map'


Regards,

Lei Tian

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
jomo frank Wed, 09/15/2010 - 10:08
User Badges:

hello Jon,


I tried the command


>> router# term len 0   <--- this will mean there is no prompt and the full output is displayed.


The display is so large that i cannot capture  all the  info by scrolling and  paste  to  a text file .


Is there any method i could use to redirect output


Regards

Jon Marshall Wed, 09/15/2010 - 10:15
User Badges:
  • Super Blue, 32500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN

rbglusers wrote:


hello Jon,


I tried the command


>> router# term len 0   <--- this will mean there is no prompt and the full output is displayed.


The display is so large that i cannot capture  all the  info by scrolling and  paste  to  a text file .


Is there any method i could use to redirect output


Regards



There are quite a few ways to do this but as you have the putty client simply use that to capture the text. See this link for details -


http://itknowledgeexchange.techtarget.com/network-technologies/how-to-capture-a-text-using-putty-client/


Jon

burleyman Wed, 09/15/2010 - 10:39
User Badges:
  • Blue, 1500 points or more

Also if you want to remove the "more" from a text file just do this in notepad......


Let's say you see this in your text file...


--More--         dot11 syslog


What you need to do is highlight from the beginning of the line to the d

include the spaces at the end of and begining of  --More--

Then right click on what you highlighted and choose copy

Now go to Edit----->Replace

and right click in the Find what box and choose paste

now just clcik once in the Replace with box and leave it blank

Now choose Replace All


and you should be good.



Mike

Lei Tian Wed, 09/15/2010 - 10:59
User Badges:
  • Cisco Employee,

Hi Jomo,


Another option, you can do; but I think that is more complex than Jon's suggestion:)


3750_2#show policy-map int | redirect ?
  flash1:  Uniform Resource Locator
  flash:   Uniform Resource Locator
  ftp:     Uniform Resource Locator
  http:    Uniform Resource Locator
  https:   Uniform Resource Locator
  nvram:   Uniform Resource Locator
  rcp:     Uniform Resource Locator
  scp:     Uniform Resource Locator
  tftp:    Uniform Resource Locator


HTH,

Lei Tian

jomo frank Thu, 09/16/2010 - 08:06
User Badges:

Hello Tan,


I am interested in your suggestion i attempted to redirect to a remote tftp server see command


router11#show policy-map int | redirect tftp:xxx.xxx.xxx.xxx


but when a check the tftp root direct location on my computer no file is copied maybe i am missing some step in the above command.


Regards


Jomo
  

Jon Marshall Wed, 09/15/2010 - 09:49
User Badges:
  • Super Blue, 32500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN

rbglusers wrote:


Hello expert,

I using putty software to access my router.

I would like to copy the result of SH POLICY-MAP INT to a text file for analysis.

The problem I encounter is the display is beyond the screen hence I have to press space bar for further display.

Is there a way I can execute the SH POLICY-MAP INT and redirect the output a text file or remove the more prompt found below the result page.

Regards

Jomo


Jomo


In enable mode on your router -


router# term len 0   <--- this will mean there is no prompt and the full output is displayed


your command goes here


router# term len 24  <-- this just puts it back to normal


Jon

Jon Marshall Thu, 09/16/2010 - 08:21
User Badges:
  • Super Blue, 32500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN

Can you ping the tftp server ?


Does it have permissions to write the file ?


What tftp server is it ?


Jon

jomo frank Thu, 09/16/2010 - 08:43
User Badges:

hello Jon,


Can you ping the tftp server ?


yes i test from within the router




Does it have permissions to write the file ?


unsure about the question.



What tftp server is it ?


Cisco tftp server 1.1


Regards

Jomo

Lei Tian Thu, 09/16/2010 - 08:48
User Badges:
  • Cisco Employee,

Hi Jomo,


Do some quick test.


show policy-map int | red flash:show

copy flash:show tftp:


Are you able to copy the file to tftp srv?


Regards,

Lei Tian

jomo frank Thu, 09/16/2010 - 09:14
User Badges:

hello Tian,


The test was sucessful . the file was transfer to tftp site


Regards


Jomo

jomo frank Thu, 09/16/2010 - 10:06
User Badges:

Hello Tian,


Thanks a million , the command given in your post did the trick .


Keep up the good work.


Regards


Jomo

Actions

This Discussion