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 Nájsť súbory, ktoré obsahujú hľadané slová na 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. Ak chcete nájsť súbory, ktoré obsahujú kľúčové slová, linux má silný príkaz s názvom grep, ktoré môžete použiť na nájdenie riadky vnútri ľubovoľný súbor alebo zoznam súborov. I use this very often to find a function declaration in a set of php files that I'm unfamiliar with. Používam to veľmi často nájsť deklaráciu funkcie v súbore php súbory, ktoré som sa nepoznajú.

Let's say we are looking for the definition of a function called wp_content_filterize, and we don't know where to start. Povedzme, že hľadáme pre definíciu funkcie nazvaná wp_content_filterize, a my nevieme, kde začať. Let's try using grep… Tak skúste grep ...

grep -i -n 'function wp_content_filterize' * grep-i-n 'funkcie wp_content_filterize' *

We should see the output right on the console Mali by sme vidieť výstup priamo na konzole

functions.php:18:function wp_content_filterize($thefilter) { functions.php: 18: function wp_content_filterize ($ thefilter) (

Now we know that the function definition is found in the file functions.php, on line 18. Teraz vieme, že definícia funkcie sa nachádza v súbore functions.php, na linke 18.

This article was originally written on 09/11/06 Tagged with: Tento článok bol pôvodne napísaný na 09/11/06 Tagged s: Ubuntu Ubuntu

Daily Email Updates Denný Svářeč

You can get our how-to articles in your inbox each day for free. Môžete si naše jak-na články vo vašej schránky každý deň zadarmo. Just enter your name and email below: Stačí zadať svoje meno a e-mail nižšie:


Name: Meno:
Email: E-mail:

Comments (7) Komentáre (7)

  1. Ajo Paul Ajo Paul

    find . nájsť. -name “filenames” -exec grep -i -H -n 'texttofind' {} \; -name "súborov"-exec grep-i-H-n 'texttofind' () \;

    To search within sub-directories Ak chcete hľadať v sub-adresáre

  2. Mark Olech Mark Olech

    I use windows 2000 and xp. Používam Windows 2000 a XP. I need a way to search withing a list of text files for a specific number. Potrebujem spôsob vyhľadávania v zozname textových súborov pre konkrétne číslo. 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. Chcem, aby sa potom s výsledkami vyhľadávania a výstupné riadky textu, ktoré obsahujú toto číslo do textového súboru, prípadne html dokument, ktorý sa potom otvorí. Basically, I need to output the results into some form of data that I can easily read. V podstate musím výstup výsledkov do nejakej formy údajov, ktoré môžem ľahko čitateľné. Are there any free programs that I can use to do this or do you have any ideas? Existujú nejaké voľné programy, ktoré môžem použiť na to, alebo máte nejaké nápady?

  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). Teraz I'm using Ubuntu-LINUX, ale skôr, ako keď som pracoval vo winXP-jeden z mojich preferovaných aplikácií, boli Agent vyrabovať (freeware). Here is its offcial webpage: Tu je jeho offcial webovej stránky:

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

    This application is the only i would like to have in UBUNTU. Táto aplikácia je len by som chcel mať v 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!! Akonáhle je nainštalovaný, stačí si kliknúť sekundárnym tlačidlom myši na adresár a kliknite na "Vyhľadávanie s agentom vyplieniť", a fantastické ...: to veľmi rýchlo nájsť všetky súbory (s uvedením presnej línie), ktorý obsahuje reťazec hľadáte!

    I would like to know if exists some like this for UBUNTU Chcel by som vedieť, či existuje nejaký takhle UBUNTU ;) )) ))

    SERGIO R. SERGIO R.

  4. imasdeweb.com imasdeweb.com

    Eyyyy… i found it. Eyyyy ... Našiel som to.
    Great application for developers (indeed for UBUNTU): Skvelé aplikácie pre vývojárov (samozrejme pre Ubuntu):

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

    ;)

    SERGIO SERGIO

  5. The Geek Geek

    @Sergio: @ Sergio:

    That's a really awesome find! To je naozaj úžasné nájsť! I've always wanted an app like that… will be featuring an article about it. Vždy som chcel app takhle ... bude predstavovať článok o tom.

  6. speed Rýchlosť

    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 ? Ako môžem nájsť nejaký text, iba v niektorých špecifických súborov v adresári, povedzme chcem grep pozrieť len v. c súbory?

  7. Anderson Anderson

    @Ajo : @ 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) V skutočnosti môžete použiť voľbu-R na grep to robiť rekurzívne (možno je to posledná vec, tento post sa späť do roku 2007, já vím)

    grep -R 'pattern' * grep-R 'vzor' *


Leave a Comment Zanechať komentár




Leave your Zanechajte svoj friendly priateľský comment here. komentár tu.

If you have a computer help question, Ak máte počítač pomôže otázku, click here to leave it on the forums kliknite tu nechať to na fórach instead. miesto.

Note: Your comment may not show up immediately on the site. Poznámka: Váš komentár sa nezobrazia okamžite na mieste.

Our Friends Naši priatelia
Getting Started Začíname


About How-To Geek O tom, ako-To Geek
What Is That Process? Čo je to za proces?
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. All Rights Reserved.