Subscribe to How-To Geek Підписатись на How-To Geek

Important! This is an automatic machine translated page. If you can read english, you should Click Here to read the original English version of the article.

Find files containing search terms on Ubuntu Пошук файлів, що містять умови пошуку на Ubuntu

To find files containing keywords, linux has a powerful command called grep, which you can use to find the lines inside any file or a list of files. Щоб знайти файли, що містять ключові слова, Linux має потужну команду називають Grep, який можна використовувати для пошуку лініями всередині будь-якого файлу або списку файлів. I use this very often to find a function declaration in a set of php files that I'm unfamiliar with. Я використовую це дуже часто, щоб знайти оголошення функції в набір PHP файлів, які я знаком с.

Let's say we are looking for the definition of a function called wp_content_filterize, and we don't know where to start. Скажімо, ми шукаємо для визначення функції називається wp_content_filterize, і ми не знаємо з чого почати. Let's try using grep… Давайте спробуємо використовувати Grep ...

grep -i -n 'function wp_content_filterize' * Grep-I-N 'функція wp_content_filterize' *

We should see the output right on the console Ми повинні бачити правом виходу на консолі

functions.php:18:function wp_content_filterize($thefilter) { functions.php: 18: функція wp_content_filterize ($ фільтру) (

Now we know that the function definition is found in the file functions.php, on line 18. Тепер ми знаємо, що функція визначення можна знайти у файлі functions.php, у рядку 18.

This article was originally written on 09/11/06 Tagged with: Ця стаття була спочатку написана на 09/11/06 тегами: Ubuntu Ubuntu

Daily Email Updates Email Щоденні оновлення

You can get our how-to articles in your inbox each day for free. Ви можете отримати наші довідкові статті у Вашу поштову скриньку щодня безкоштовно. Just enter your name and email below: Просто введіть ваші ім'я та адресу електронної пошти нижче:


Name: Ім'я:
Email: Електронна пошта:

Comments (7) Коментарі (7)

  1. Ajo Paul Ахо Поль

    find . знайти. -name “filenames” -exec grep -i -H -n 'texttofind' {} \; -наме "імен"-Exec Grep-І-Н-N 'texttofind' () \;

    To search within sub-directories Щоб виконати пошук в підкаталогах

  2. Mark Olech Марк Olech

    I use windows 2000 and xp. Я використовую Windows 2000 і XP. I need a way to search withing a list of text files for a specific number. Мені потрібен спосіб пошуку в список текстових файлів для конкретного числа. I want to then take the search results and output the lines of text containing this number to a text file, or possibly an html document that will then open up. Я хочу, щоб потім прийняти результати пошуку і виводу рядка тексту, що містять цей номер в текстовому файлі або, можливо, HTML-документ, який буде потім відкрити. Basically, I need to output the results into some form of data that I can easily read. В основному, мені необхідно для виведення результатів у тій чи іншій формі дані, які я можу легко читати. Are there any free programs that I can use to do this or do you have any ideas? Чи існують безкоштовні програми, які я можу використовувати для цього або ж у вас є ідеї?

  3. imasdeweb.com imasdeweb.com

    Now i'm using UBUNTU-LINUX, but before -when i worked in winXP- one of my preferred applications were Agent Ransack (freeware). Тепер я Використання Ubuntu-Linux, але колись, коли я працював в WinXP-один з моїх бажаних додатків були Агент Ransack (безкоштовна). Here is its offcial webpage: Ось його Offcial веб-сторінку:

    http://www.mythicsoft.com/agentransack/ http://www.mythicsoft.com/agentransack/

    This application is the only i would like to have in UBUNTU. Ця програма є єдиним Я хотів би мати в Ubuntu. Once it is installed, you simply do click with secondary button mouse over a directory and click on “Search with Agent Ransack”, and… fantastic: it find very rapidly all files (indicating the exact line) wich contains the string you search!! Після установки, ви просто клацніть середньою кнопкою миші над каталозі і натисніть "Пошук в Ransack Агент", і ... фантастичний: він дуже швидко знайти всі файли (із зазначенням точної лінія), яка містить рядок пошуку ви!

    I would like to know if exists some like this for UBUNTU Я хотів би знати, існує деякий як це для UBUNTU ;) )) ))

    SERGIO R. SERGIO Р.

  4. imasdeweb.com imasdeweb.com

    Eyyyy… i found it. Eyyyy ... Я знайшла його.
    Great application for developers (indeed for UBUNTU): Великий додатків для розробників (дійсно для Ubuntu):

    http://regexxer.sourceforge.net http://regexxer.sourceforge.net

    ;)

    SERGIO SERGIO

  5. The Geek Грайте та вигравайте

    @Sergio: @ Sergio:

    That's a really awesome find! Це дійсно знайти Awesome! I've always wanted an app like that… will be featuring an article about it. Я завжди хотів App такий ... буде Featuring статтю про нього.

  6. speed Швидкість

    how do I find some text only in some specific files in a directory, lets say I want grep to look only in .c files only ? Як мені знайти який-небудь текст тільки в деяких конкретних файлів в каталозі, дозволяє сказати, що я хочу Grep дивитися тільки у форматі. C файли тільки?

  7. Anderson Андерсон

    @Ajo : @ Ахо:
    In fact you can use -R option on grep to do it recursively (maybe it's a recent thing, this post is back to 2007, I know) Фактично ви можете використовувати опцію-R на Grep зробити це рекурсивно (Може бути, це остання річ, що цю посаду повернувся в 2007 році, я знаю)

    grep -R 'pattern' * Grep-модель R''*


Our Friends Наші друзі
Getting Started Приступаючи до роботи


About How-To Geek Про How-To Geek
What Is That Process? Що це за процес?
svchost.exe svchost.exe
jusched.exe jusched.exe
dwm.exe dwm.exe
ctfmon.exe Ctfmon.exe
wmpnetwk.exe wmpnetwk.exe
wmpnscfg.exe wmpnscfg.exe
rundll32.exe rundll32.exe
wfcrun32.exe wfcrun32.exe
Ipoint.exe Ipoint.exe
Itype.exe Itype.exe
Wfica32.exe Wfica32.exe
Mobsync.exe Mobsync.exe
conhost.exe conhost.exe
Dpupdchk.exe Dpupdchk.exe Adobe_Updater.exe Adobe_Updater.exe

Copyright © 2006-2009 HowToGeek.com. Copyright © 2006-2009 HowToGeek.com. All Rights Reserved. Всі права захищені.