puTTy help

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Please help a total noob. I'm using puTty to access a linux server. I
grep strings from compressed directories. I would then like to be able
to search those results on my puTTy screen. Is this possible?

Re: puTTy help

Quoted text here. Click to load it

Yes, but it's neither an ssh or putty question really.  It's more of a
unix shell question.   But try this:

$ strings bigdirectoryiwannagrep/* | grep myfavoritegrepstring | less

Space bar pages down, b takes you back a screen in less anyway,
capital G to get to the end, capital P to get back to teh beginning.

If less isn't available as a pager on that system, try

$ strings bigdirtory/* | grep blah | more

More more info:

$ man less
$ man more

Best Regards,
Todd H.
http://www.toddh.net /

Re: puTTy help

Todd H. wrote:
Quoted text here. Click to load it

Thanks Todd, I'll try these.

So I take it there is no way to actually search these results of a grep
short of outputting it to a text file and searching that?

The guy next to me uses a Mac and his terminal program lets him search
the screen. It would save a few steps.


Re: puTTy help

Quoted text here. Click to load it
Quoted text here. Click to load it

I think the concept you may be missing is what a the pipe (|)
character does.   It obviates the need to put output into a disk file
and handles things "on the fly" if you will.

The command above looks for strings in all files in
bigdirctoryiwannagrp, pipes the standard output (stdout) to the grep
function which searches among those string for lines that match
myfavoritegrepstring, and then pipes that to a program that allows you
to page through the output (which is very handy if you get more than a
screen full of output).

Quoted text here. Click to load it

Interest--didn't know it had that feature.  That would be a client
side way of doing it, but what if the terminal program has a
scrollback buffer set to something smaller than the output you've
created?  You may miss something.  That's why it's better to handle
the output yourself, in my opinion.

However, there's another command line program that'll do what you

$ screen

It can search it's history, but I've never had occasion to do that.

Not the answer you wanted, but some ideas anyway.

Best Regards,
Todd H.
http://www.toddh.net /

Re: puTTy help

Quoted text here. Click to load it

AbsoluteTelnet has screen search capability.  Use Edit->Find and enter a
word or phrase.  All occurrences of that word will display in reverse red
blinking text.  Find->Previous and Find->next will seek to places in
the scrollback where the word exists.  Very handy.  Saves time.


Brian Pence
Celestial Software

Site Timeline