Suvayu, I read your comment, and googled about what I can't understand.

In Emacs, M-x grep <RET> Filename * <RET> does what I want. Thank you.

And now, I want to make it as one elisp command.

What should I do? Can anybody write a simple script?

Sincerely, Jeongtae.


suvayu ali <fatkasuvayu+linux@gmail.com>
2010/9/13 suvayu ali <fatkasuvayu+linux@gmail.com>
2010/9/12 ³λΑ€ΕΒ <basil83@gmail.com>:
> Thank you everyone.
>
> I learned I could do it with grep, but I don't know how to use grep
> properly.
>

grep is one of my favourite *nix tools. :)

You can try invoking grep in many ways. these are my most used options,

1. simply search for a regex and show results.
   grep -nH -E <regex> <wildcard_to_match files>
2. search for results and show results with context
   grep -nHB <number> -E <regex> <wildcard_to_match files>
   # context lines before matching lines
   grep -nHA <number> -E <regex> <wildcard_to_match files>
   # context lines after matching lines
   grep -nHC <number> -E <regex> <shell_wildcard_to_match files>
   # context lines from both before and after matching lines
3. You can try `M-x find-grep' if you want more control over what file
you want to search
   find -type f -name <shell_wildcard_to_match_files> -print0 | xargs
-0 grep -nH -E <regex>

Note: find and grep regex are a little different from emacs regex
because of some quoting differences. 'man grep' is your friend.

GL :)

--
Suvayu

Open source is the future. It sets us free.