Multiple find and replace of content using Grep إيجاد المتعددة وتحل محل للمحتوى باستخدام Grep
Posted on December 3, 2008 at 5:35 am تنشر على 3 كانون الاول / ديسمبر ، 2008 في 5:35 صباحا
We have posted articles about searching for files and file content using لقد نشرت مقالات عن البحث عن الملفات وملف باستخدام المحتوى Super Finder سوبر كشاف and و Google Desktop جوجل سطح المكتب . 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. لقد تم استخدام للتنمية المتكاملة للبيئة (IDEs) أدوات مثل 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. الاحتياطية الملفات ستكون محفوظة على مجلد مع نفسه ". باك" التمديد. وبهذه الطريقة يمكنك ان "استرداد" عن طريق إعادة تسمية الملفات ". باك" ملفات.
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 ، هو أداة قوية. نلجأ اليها بحذر لانه لا يوجد "التراجع" وظيفية. تأكد من النسخ الاحتياطي الخاصة بك إلى ملفات الحرجة الأولى قبل القيام وهو يحل محل. يمكنك الحصول على grepWin مجانا من موقع Google رمز :
http://code.google.com/p/grepwin/downloads/list
Ben Carigtan shows you how it’s done. بن Carigtan يظهر لك كيف يتم ذلك.
» Filed Under »المقدمة بصورة مشتركة بموجب أحكام Computer Tips نصائح الكمبيوتر
Save this page احفظ هذه الصفحة | Stir it up on Mixx اثارة الامر على Mixx | |
Add to Reddit أضف إلى [بلوجم] |
Related Posts الوظائف ذات الصلة
- Hide extensions for known file types in Windows Vista إخفاء التمديدات لأنواع الملفات المعروفة في ويندوز فيستا
- Combine or merge multiple text files using TXTCollector دمج أو الجمع بين عدة ملفات نصية باستخدام TXTCollector
- Combine multiple commands and executables into a single exe الجمع بين القيادة ومتعددة للتنفيذ في واحد إكس
- Find and remove duplicate files with Duplicate Cleaner إيجاد وإزالة الملفات المكررة مع المكررة الأنظف
- Create HTML table listing of Windows directories and files خلق هتمل الجدول قائمة من أدلة وملفات ويندوز






















