Help us understand the problem. What is going on with this article?

Git管理下のテキストファイルから文字列検索してファイル名取得

More than 5 years have passed since last update.

"xxx"を検索する場合:

$ git grep -I xxx | sed -e "s/:.*$//" | uniq
foo
bar.html
hoge/fuga.txt
hoge/piyo.txt
  • git grepで、Git管理下のファイルのみから検索
    • -Iでバイナリを除外
  • git grepが結果としてファイル名とその行を出力するので、sedでファイル名部分のみに
  • uniqで同じファイル名はひとつに

※ファイル名に":"が含まれるとグワーーーー

ginpei
JavaScriptとかお寿司とかが好きです。
http://ginpei.info
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした