Subscribe to How-To Geek Mag-subscribe sa Paano-Upang 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 Maghanap ng mga file na naglalaman ng mga kataga sa paghahanap sa 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. Upang mahanap ang mga file na naglalaman ng mga keyword, linux ay may isang malakas na utos na tinatawag na grep, na kung saan maaari mong gamitin upang mahanap ang mga linya sa loob ng anumang file o isang listahan ng mga file. I use this very often to find a function declaration in a set of php files that I'm unfamiliar with. Gamitin ko ito napakadalas upang mahanap ang isang function ng deklarasyon sa isang set ng php file na ako pamilyar sa mga.

Let's say we are looking for the definition of a function called wp_content_filterize, and we don't know where to start. Ipagpalagay natin na tayo ay naghahanap sa kahulugan ng isang function na tinatawag na wp_content_filterize, at hindi namin alam kung saan magsisimula. Let's try using grep… Let's subukang gumamit ng grep ...

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

We should see the output right on the console Dapat nating makita ang output karapatan sa console

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. Ngayon, alam natin na ang mga function na kahulugan ay matatagpuan sa functions.php file, sa linya 18.

This article was originally written on 09/11/06 Tagged with: Ang artikulong ito ay orihinal na isinulat sa 09/11/06 Tagged with: Ubuntu Ubuntu

Daily Email Updates Araw-araw na Updates Email

You can get our how-to articles in your inbox each day for free. Maaari kang makakuha ng aming kung-paano na mga artikulo sa iyong inbox sa bawat araw para sa libre. Just enter your name and email below: Ilagay lamang ang inyong pangalan at email sa ibaba:


Name: Pangalan:
Email: Email:

Comments (7) Comments (7)

  1. Ajo Paul Ajo Pablo

    find . hanapin. -name “filenames” -exec grep -i -H -n 'texttofind' {} \; -pangalan na "filename"-exec grep-i-H-n 'texttofind' () \;

    To search within sub-directories Upang maghanap sa loob ng mga sub-directories

  2. Mark Olech Markahan ang Olech

    I use windows 2000 and xp. Gamit ko windows 2000 at xp. I need a way to search withing a list of text files for a specific number. Kailangan ko ng isang paraan upang maghanap sa loob ng isang listahan ng text file para sa isang tiyak na numero. 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. Gusto kong abutin ang mga resulta sa paghahanap at output ang mga linya ng teksto na naglalaman ng mga numerong ito para sa isang text file, o marahil isang html na dokumento na pagkatapos ay buksan ang up. Basically, I need to output the results into some form of data that I can easily read. Karaniwang, kailangan kong mag-output ng mga resulta sa ilang uri ng data na maaari kong madaling basahin. Are there any free programs that I can use to do this or do you have any ideas? Mayroon bang anumang mga libreng programa na maari kong gamitin upang gawin ito o mayroon kang anumang mga ideya?

  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). Ngayon gumagamit ako ng Ubuntu-Linux, ngunit bago-kapag ako ay nagtrabaho sa winXP-isa sa aking mga ginustong mga aplikasyon ay Agent nakawan (Freeware). Here is its offcial webpage: Narito ang kanyang offcial webpage:

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

    This application is the only i would like to have in UBUNTU. Ang application na ito ay ang tanging ako ay nais magkaroon sa 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!! Kapag ito ay nai-install, kailangan lang gawin i-click sa pangalawang button mouse sa ibabaw ng isang direktoryo at i-click ang "Search sa Agent nakawan", at ... hindi kapani-paniwala: mapulot ito masyadong mabilis ang lahat ng mga file (na nagpapahiwatig na ang eksaktong linya) na naglalaman ng mga string na iyong paghahanap!

    I would like to know if exists some like this for UBUNTU Gusto kong malaman kung umiiral na ang ilang mga tulad nito para sa Ubuntu ;) )) ))

    SERGIO R. Sergio R.

  4. imasdeweb.com imasdeweb.com

    Eyyyy… i found it. Eyyyy ... i found ito.
    Great application for developers (indeed for UBUNTU): Great aplikasyon para sa mga developer (sa katunayan, para sa Ubuntu):

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

    ;)

    SERGIO Sergio

  5. The Geek Ang Geek

    @Sergio: @ Sergio:

    That's a really awesome find! Iyan ay isang tunay na makahanap ng awesome! I've always wanted an app like that… will be featuring an article about it. Lagi ko na wanted isang app na gusto ... ay nagtatampok ng isang artikulo tungkol sa mga ito.

  6. speed bilis

    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 ? kung paano ko mahahanap ang ilang text lamang sa ilang tiyak na mga file sa direktoryo, nagbibigay-daan sa sinasabi ko na gusto grep upang tumingin lamang sa. c file na lamang?

  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) Sa katunayan maaari mong gamitin-R pagpipilian sa grep gawin ito recursively (marahil ito ay isang kamakailan-lamang na bagay, ang post na ito ay bumalik sa 2007, alam ko)

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


Leave a Comment Iwanan ng isang Puna




Leave your Iwanan ang iyong mga friendly friendly comment here. puna dito.

If you have a computer help question, Kung ikaw ay may isang computer ng tulong tanong, click here to leave it on the forums i-click dito upang mag-iwan ito sa forums instead. sa halip ng.

Note: Your comment may not show up immediately on the site. Tandaan: Ang iyong puna ay maaaring hindi magpapakita agad sa site.

Our Friends Ang aming mga Friends
Getting Started Pagsisimula


About How-To Geek Tungkol sa Paano-Upang Geek
What Is That Process? Ano ba ang Proseso Iyon?
svchost.exe svchost.exe
jusched.exe jusched.exe
dwm.exe dwm.exe
ctfmon.exe ctfmon.exe
wmpnetwk.exe wmpnetwk.exe
mDNSResponder.exe mDNSResponder.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.