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 Rasti failus, kuriuose yra paieškos 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. Jei norite rasti failus, kuriuose yra žodžiai "," Linux "yra galinga komanda pakvietė grep, kurį galite naudoti norėdami rasti viduje, bet failo ar failų sąrašas linijos. I use this very often to find a function declaration in a set of php files that I'm unfamiliar with. Aš naudoju šį labai dažnai rasti funkcija deklaraciją PHP failų rinkinys, kad aš nežino.

Let's say we are looking for the definition of a function called wp_content_filterize, and we don't know where to start. Tarkime, ieškome funkcijos apibrėžimas vadinamas wp_content_filterize, ir mes nežinome, kur pradėti. Let's try using grep… Let's try naudojant grep ...

grep -i -n 'function wp_content_filterize' * grep-i-n "funkcija wp_content_filterize '*

We should see the output right on the console Turėtume produkcija tiesiai ant konsolės

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

Now we know that the function definition is found in the file functions.php, on line 18. Dabar mes žinome, kad funkcijos apibrėžimas rasti failo functions.php, on line 18.

This article was originally written on 09/11/06 Tagged with: Šis straipsnis buvo parašytas ant 09/11/06 Tagged with: Ubuntu Ubuntu

Daily Email Updates Dienos paštas Atnaujinimai

You can get our how-to articles in your inbox each day for free. Galite gauti mūsų kaip prie straipsnių į Jūsų pašto dėžutę kasdien nemokamai. Just enter your name and email below: Tiesiog įveskite vardą ir elektroninio pašto adresą žemiau:


Name: Pavadinimas:
Email: Paštas:

Comments (7) Komentarai (7)

  1. Ajo Paul Ajo Paulius

    find . rasti. -name “filenames” -exec grep -i -H -n 'texttofind' {} \; -name "vardus"-exec grep-i-O-N 'texttofind "() \;

    To search within sub-directories Norėdami atlikti paiešką pagal sub-katalogus

  2. Mark Olech Pažymėti Olech

    I use windows 2000 and xp. Aš naudoju Windows 2000 ir XP. I need a way to search withing a list of text files for a specific number. Man reikia atlikti paiešką pagal iš tekstinių failų sąrašą konkrečių skaičių. 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. Noriu ten būti paieškos rezultatuose ir išėjimo iš teksto su šio numerio tekstinį failą, ar galbūt HTML dokumentą, tada atverti linijas. Basically, I need to output the results into some form of data that I can easily read. Iš esmės, man reikia, kad išėjimo į keletą duomenų forma, kad galiu lengvai skaityti rezultatus. Are there any free programs that I can use to do this or do you have any ideas? Ar yra kokia nors nemokama programą, kad galėčiau tai padaryti, arba turite kokių nors idėjų?

  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). Dabar aš naudoju Ubuntu Linux, bet prieš ", kai aš dirbau WinXP-vienas iš mano pageidaujamą paraiškų Konsultantas knaisiotis (freeware). Here is its offcial webpage: Čia yra jo offcial svetainė:

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

    This application is the only i would like to have in UBUNTU. Ši paraiška yra tik norėčiau, kad 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!! Kai jis yra įdiegtas, jums tiesiog spustelėkite vidurinį mygtuką su pele per katalogą ir paspauskite "Paieška Konsultantas apvogti", ir ... fantastinis: jis labai greitai surasti visus failus (nurodant tikslią eilutę), kuriame yra eilutės ieškoti!

    I would like to know if exists some like this for UBUNTU Aš norėčiau žinoti, jei egzistuoja tam Panašios Ubuntu ;) )) ))

    SERGIO R. SERGIO R.

  4. imasdeweb.com imasdeweb.com

    Eyyyy… i found it. Eyyyy ... aš rasiu jį.
    Great application for developers (indeed for UBUNTU): Puikus taikymo kūrėjams (iš tiesų ubuntu):

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

    ;)

    SERGIO SERGIO

  5. The Geek Geek

    @Sergio: @ Sergio:

    That's a really awesome find! Tai tikrai nuostabus rasti! I've always wanted an app like that… will be featuring an article about it. Aš visada norėjau, kaip kad progr ... bus featuring apie tai straipsnis.

  6. speed greitis

    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 ? Kaip rasti tekstą tik kai kurie failai yra kataloge, tarkim aš noriu grep ieškoti tik. C tik failus?

  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) Be to, galite naudoti-R parinktį grep tai padaryti rekurentiniu (gal tai neseniai dalykas, šis pranešimas yra grįžti į 2007 m., aš žinau)

    grep -R 'pattern' * grep-R "modelis" *


Our Friends Mūsų draugai
Getting Started Paruo


About How-To Geek Apie How-To Geek
What Is That Process? Kas yra šis procesas?
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.