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 Atrast failus, kas satur meklēšanas nosacījumus par 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. Lai atrastu failu, kas satur atslēgvārdus, linux ir spēcīga komanda sauc grep, kuru jūs varat izmantot, lai atrastu iekšpusē jebkuru failu vai failu sarakstu līnijas. I use this very often to find a function declaration in a set of php files that I'm unfamiliar with. Es izmantoju šo ļoti bieži, lai atrastu funkcijas deklarāciju kopums php files, ka es esmu svešs ar.

Let's say we are looking for the definition of a function called wp_content_filterize, and we don't know where to start. Let's say mēs meklējam definīciju funkciju sauc wp_content_filterize, un mēs nezinām, kur sākt. Let's try using grep… Let's pamēģiniet izmantot grep ...

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

We should see the output right on the console Mums vajadzētu redzēt produkcija tiesības konsole

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. Tagad mēs zinām, ka funkcijas definīcija ir atrodams fails functions.php, uz 18 līnijas.

This article was originally written on 09/11/06 Tagged with: Šis pants tika sākotnēji rakstīts uz 09/11/06 tagged with: Ubuntu Ubuntu

Daily Email Updates Daily Email Updates

You can get our how-to articles in your inbox each day for free. Jūs varat saņemt mūsu how-to rakstus savā pastkastītē katru dienu par brīvu. Just enter your name and email below: Vienkārši ievadiet jūsu vārdu un e-pasta zemāk:


Name: Vārds:
Email: E-pasts:

Comments (7) Komentāri (7)

  1. Ajo Paul Ajo Paul

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

    To search within sub-directories Meklēt apakšpozīcijas ietvaros katalogi

  2. Mark Olech Mark Olech

    I use windows 2000 and xp. I use Windows 2000 un XP. I need a way to search withing a list of text files for a specific number. Man ir veids, kā meklēt sarakstu teksta failus konkrētu skaitu. 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. Es gribu, lai pēc tam veikt meklēšanas rezultātiem un izvadei no teksta, kas satur šo numuru, teksta failu, vai, iespējams html dokumentu, tad atvērt līnijām. Basically, I need to output the results into some form of data that I can easily read. Būtībā man ir nepieciešams, lai atveidotu vērā kāda veida datus, kas man var viegli nolasīt rezultātus. Are there any free programs that I can use to do this or do you have any ideas? Vai ir kādas bezmaksas programmas, ka es varu izmantot to darīt, vai jums ir kādas idejas?

  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). Tagad es esmu, izmantojot Ubuntu, Linux, bet pirms, kad es strādāju ar WinXP-viena no manām vēlamo pieteikumu Agent izkratīt (freeware). Here is its offcial webpage: Šeit ir tā offcial webpage:

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

    This application is the only i would like to have in UBUNTU. Šis pieteikums ir tikai vēlos būt 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!! Kad tā ir instalēta, varat vienkārši noklikšķināt ar vidējo pogu peli directory un nospiediet "Meklēt ar Agent izkratīt", un ... fantastiski: tajā atradīsiet ļoti ātri visus failus (norādot precīzu līnija), kas satur virkni meklējat!

    I would like to know if exists some like this for UBUNTU Es gribētu zināt, vai pastāv dažas, piemēram, tas par Ubuntu ;) )) ))

    SERGIO R. SERGIO R.

  4. imasdeweb.com imasdeweb.com

    Eyyyy… i found it. Eyyyy ... i atradis.
    Great application for developers (indeed for UBUNTU): Liels pieteikumu attīstītājiem (pat par Ubuntu):

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

    ;)

    SERGIO SERGIO

  5. The Geek Geek

    @Sergio: @ Sergio:

    That's a really awesome find! Tas ir patiešām satriecošs atrast! I've always wanted an app like that… will be featuring an article about it. Man vienmēr gribējies app, piemēram, ka ... būs featuring raksts par to.

  6. speed ātrums

    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 ? kā es varu atrast kādu tekstu tikai dažos specifiskos failus direktorijā, ļauj teikt, es gribu grep meklēt tikai. c failus tikai?

  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) Patiesībā jūs varat izmantot-R opciju grep to darīt rekursīvi (varbūt tas ir pēdējā lieta, šis amats ir atpakaļ uz 2007, es zinu)

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


Leave a Comment Leave Comment




Leave your Atstājiet savu friendly draudzīgs comment here. komentārus šeit.

If you have a computer help question, Ja Jums ir dators palīdzēt jautājumu, click here to leave it on the forums click here to atstāt uz forumu instead. vietā.

Note: Your comment may not show up immediately on the site. Piezīme: Jūsu komentārs var neparādīties pat tieši uz vietas.

Our Friends Our Friends
Getting Started Getting Started


About How-To Geek Par How-To Geek
What Is That Process? Kas ir šis 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. All Rights Reserved.