emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: suvayu ali <fatkasuvayu+linux@gmail.com>
To: 노정태 <basil83@gmail.com>
Cc: org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: Re: Search files in a folder
Date: Sun, 12 Sep 2010 21:22:09 -0700	[thread overview]
Message-ID: <AANLkTi=ty1tcxRvyMOWaOjk-7JRSNTdZ9jEdOf1xbcdx@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=Vz4ufYxXbqCgz2puRhpiUSaJtXt+-p9ovyXDt@mail.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.

  reply	other threads:[~2010-09-13  4:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-12 19:11 Search files in a folder 노정태
2010-09-12 19:31 ` Eric S Fraga
2010-09-12 20:29   ` suvayu ali
2010-09-13  1:51   ` Matt Lundin
2010-09-13  4:09     ` 노정태
2010-09-13  4:22       ` suvayu ali [this message]
2010-09-13  7:15         ` 노정태
2010-09-13 16:19           ` Matt Lundin
2010-09-14 16:06             ` 노정태
2010-09-20  8:31             ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=ty1tcxRvyMOWaOjk-7JRSNTdZ9jEdOf1xbcdx@mail.gmail.com' \
    --to=fatkasuvayu+linux@gmail.com \
    --cc=basil83@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).