2010/9/12 노정태 <address@hidden>:
> 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.