Is there a easy way for me to:
- search for a string in the output window of the putty ?
- or even a Linux command to search and highlight a string in the output ?
I have 20,000+ lines in the output and sometimes I have to search for customer_id : 1111
and currently I have to copy them to word or notepad and then search.
Is there a better way to do this ?
I use a very clever trick (if I do say so).
Answer is NO, putty can't do a find in the scroll back buffer.
Here's my workaround:
I enable putty session logging, and then have the session log open in GxTail, which is a text viewer that updates in real time. I have the windows open side by side (or one on each monitor), and when I issue a command in putty, the output is in the GxTail window. GxTail has full find (ctrl-f) like any text editor.
It's the next best thing to having ctrl-f working in putty. Works great for long cisco running-configs, where the | inc pipe command has shortcomings.
If you don't care about the rest of the output, then
will only print the lines that contain "some regular expression".
will send the output of your command to the
less
command which lets you scroll up and down the output. You can search by typing/some regular expression
and pressing enter.q
will close the program.If you do want to save the file, then
will send the output to a file instead of the screen, which you can open in an editor and search instead of displaying it on the screen. If it exists,
outputfile
will be erased before yourcommand runs. You can add the output to the end of an existing file if you use>>
instead.The
tee
program lets you save the output to a file and send it to another program at the same time:This will save the original output to
outputfile
and pass it to some other command.I'd suggest that in the future you enable PuTTY logging, ensuring the log size is appropriate. Doing that you can use any half decent text editor to open the log and search for any part of the text you desire, whether it's your input or the remote system's output.
To search for characters in the file:
then you type
/
and type the character you are looking for:eg:
/a