Multiple find and replace of content using Grep複数の検索とコンテンツのはgrepを使用して置き換える

Posted on December 3, 2008 at 5:35 am 12月3日、午前5時35分で、 2008年に投稿

We have posted articles about searching for files and file content using私たちはファイルの検索とコンテンツのファイルを使用してに関する記事を掲載している Super Finderスーパーファインダー andおよび Google Desktop Googleデスクトップ .  But what if you have a bunch of files wherein you want to actually replace a content inside them?しかし、もしそこを実際に内部のコンテンツを置き換えるしたいファイルを抱えているか? sure you can use Notepad or any text editor to find and replace content for individual files but this will require you to do this on each of the files.必ず見つけることメモ帳または任意のテキストエディタを使用して個々のファイルのコンテンツを置き換えるが、この場合、それぞれのファイルの上でこれを行うに必要になります。

I have been using Integrated Development Environment (IDEs) tools like Netbeans and Visual Studio to do this for my software development projects but they are too “bloated” for plain text files.私は(代表的なIDE )とVisual StudioのようなツールNetbeansは私のソフトウェア開発プロジェクトでこの操作を実行する統合開発環境を利用しているが、あまりにも"肥大化"テキスト形式のファイルをしている。

With 〜とともに winGrep winGrep , you can do a global search and replace of any string on all files located at your inputted path:は、世界的な検索を行うことができるすべてのファイルをご入力のパスにある上の任意の文字列の置換:

Step 1 : In the “Search in” field, enter the directory path. ステップ1 :では、 " " ]フィールドに、ディレクトリのパスを入力して検索します。

Step 2 : In the “Search for” field, enter the string or regular expression ステップ2 :では、 " "フィールドの文字列または正規表現を入力して検索

Step 3 : Click “Search” button ステップ3 :クリックして"検索"ボタンを

イメージ

You should see the search results on the bottom part of the screen:場合は、画面の下部分には、検索結果が表示されます:

イメージ

The listing has a column with filename, size, matches inside the file, path and encoding type.  The “matches” column tells you how many instances of the searched word exists in the file.このリストは、ファイル名の列を、サイズのファイルが、パスを入力エンコードの中にマッチします。 " "列に一致する単語を検索する方法の指示は、ファイル内に多くのインスタンスに存在しています。

To do a search and replace, enter the replacement word in the “Replace with:” field then click “Replace”:検索と置換を行うには、 "置換後の文字列の置換単語を入力してください: "フィールドをクリックして"置換" :

イメージ

Be careful as this can ruin your files.  I usually backup my files before doing a search and replace since a replace will effectively change the content of the files. このようなお客様のファイルを台無しにすることができます注意してください。私は通常のバックアップの検索を行うと効果的には、ファイルの内容を変更するに代わる代わる前から自分のファイルを削除します。

To create backup files, make sure to check the “Create backup files” checkbox: 、 " "チェックボックス:バックアップファイルの作成を確認することを確認するバックアップファイルを作成するには

イメージ

The backup files will be saved on the same folder with a “.bak” extension.  This way you can “recover” files by renaming the “.bak” files.は、バックアップファイルが同じフォルダに" 。 bakに変更"の拡張子で保存されます。あなた" " "ファイルは、 " 。 bakに変更名前を変更しファイルを回復することができます。

If there are cases wherein you only want to make it search based on a filename pattern or file size, use the “Limit Search” options:がある場合はそこだけは、ファイル名のパターンまたはファイルのサイズには、 "制限検索"の検索オプションを使用したい場合は:

イメージ

In the example above, I set it to search only for files with a .epj extension.  You can change this to any file name extension like .log or .txt.上記の例では、私はそれだけでファイルを検索するように設定します。 epj拡張子。あなたのような任意のファイル名の拡張子を変更することができます。 ログまたは。 txtという。

winGrep, is a powerful tool.  Use it with caution because there is no “undo” functionality.  Make sure to backup your critical files first before doing a replace.  You can get grepWin for free from the Google code website: winGrep 、強力なツールです。慎重にそれを使用する理由がない"元に戻す"機能です。あなたの最初の重要なファイルをバックアップしていることを確認する前に取って代わることを無料では、 GoogleのコードをWebサイトからgrepWinを得ることができます:

http://code.google.com/p/grepwin/downloads/list

Ben Carigtan shows you how it’s done.ベンCarigtanどのように行うのが表示されます。

Enjoyed this post?この投稿を楽しんだか? Subscribe to Online Tech Tips viaチャンネル登録オンライン技術のヒントを経由 RSS Feed RSSフィード or viaまたは経由 Emailメール and receive free daily productivity tips.日々の生産性のヒントと受信は無料。

» Filed Under »ファイルの下で Computer Tipsコンピュータのヒント

おいしいに追加 Save this page このページを保存 Mixxは、 Stir it up on Mixx かき混ぜるそれをミックス
しかし Add to Reddit しかしに追加 StumbleUponの Stumble this page このページつまずく

Related Posts 関連記事

Please post your comments/suggestions! コメントを投稿してください/ご提案!