0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ripgrepはgrepよりも早い sql文で検索する

Last updated at Posted at 2022-04-06

用途

sql文で検索したい文字列を指定することで、指定した文字列が入っているテキストファイルが返ってくる。
現在grepを使っている方は多いと思いますが、断然にripgrepの方が早いです。

使用方法

コマンド
rg "検索したい文字列" 

"検索したい文字列" に入力した文字列が入っているテキストファイルが返ってくる。
※rgはripgrepの略で使用する際は、rgと入力する
 
 
そんなコマンドは無いよと言われた人は下記のコマンドを実行して、Homebrewでripgrepをインストールしてから再度試してみてください

コマンド
brew install ripgrep

 
 
brewコマンドを使ったことがない方は下記の公式サイトから Homebrew をインストールしてみてください。
https://brew.sh/index_ja

なぜ早いのか

ripgrepは、検索する必要がなさそうなファイル(隠しファイルやバイナリファイルなど)を無視するようになっている。
※バイナリファイルとは、簡単にいうとテキストファイル以外(画像、音声、動画などのファイルなど)のファイルのこと。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?