0

I am using grep to find strings in multiple files. It outputs a lot of text which is what I need, but then terminal just deletes all the output while grep continues working and so I can see only last few results grep found.

How do I make grep work?

I am sorry for noob question but I literally searched whole internet and didn't find answer. What I need is to search for text in multiply binary files recursively and output line from those binary files containing searched text.

grep does that but I can't use it, if there is another app that can do that it would be great too.

1 Answer 1

1

You can pipe the output to a pager like less, or redirect it to a file, and then read the file using your favorite editor or pager.

For example:

grep -R foo ./DIR | less    # search for foo, view a screen full at a time

or:

grep -R foo ./DIR > outputs # search for foo, and output the results to a file

less outputs                # view the file one screen full at a time
5
  • how do you use second method? I tried ' > outputs' and ' | less > output.txt' but it does not do anything.
    – nikishev.
    Oct 14, 2018 at 14:06
  • First use grep whatever > outputs it saves data to a file named outputs then with another command read outputs data for example less outputs
    – Ravexina
    Oct 14, 2018 at 14:38
  • @Ravexina in your example, it won't find "Foo". You might wish to add -i to your grep, as without it, grep is case sensitive.
    – heynnema
    Oct 14, 2018 at 17:59
  • @heynnema it's just a demonstration ... I'm sure he/she knows how to work with grep already.
    – Ravexina
    Oct 14, 2018 at 18:17
  • @Ravexina I don't think so, as the OP says "I am sorry for noob question...".
    – heynnema
    Oct 14, 2018 at 18:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .