« Home | Optimizing Memcpy improves speed » | 無線訊號接收器 » | ENUM簡介 » | WINNT/XP的boot.ini筆記 » | 為什麼Embedded Linux 也有不同套件版本?! » | Linux 常用指令 Kernel Module相關 » | Linux 常用指令-Kernel Module相關 » | 桃園縣法律諮詢資源 » | 視訊規格筆記 » | UPnP Media Server GPL-LINUX » 

2005/08/10 

find + grep 範例

Wednesday, August 10, 2005
8/10/2005 1:37:23 AM
find + grep 範例

1.
find ./ -name \*.c -exec grep -wl main {} \;
找(find)目前目錄下所有*.c的檔案
再由grep過瀘出有含main這個單字的檔案
-w 完整單字為main的才符合
-l 列出檔名

2.
find ./ -name \*.c -exec grep -wnHA5 main {} \;
找(find)目前目錄下所有*.c的檔案
再由grep過瀘出有含main這個單字的檔案
-H 顯示路徑及檔名
-n 顯示行號
-A5 並顯示以下五行內容(共六行)
-B5 同上,但為以上五行

3.
grep -inP "^\w+\s+main\s" xxx.c
找出xxx.c任一行中,第二個單字為main
-i 乎略大小寫
-P perl regular expression
^ 開頭
\w 第一個字完
\s 空白

4.聽說這個可以計算程式的行數
find . -name '*.[cCh]' -or -name '*.in' -or -name '*.cpp' | xargs wc -l

5.試試這個吧
# find /usr/include/ -name "*.h" -exec cp {} ~/include/

很好的文章...已連結

http://paulyip.blogspot.com/

If I were gold für wow a boy again,world of warcraft gold I would practice perseverance wow gold cheap more often,maple meso and never give up a thing because it was or inconvenient. If we want light,Maple Story Account we must conquer darkness. Perseverance can sometimes equal genius in its results.wow gold kaufen “There are only two creatures,”cheap maplestory mesos syas a proverb, “who can surmount the pyramids—the eagle and the snail.” If I were a boy again,wow geld I would school myself into a habit of attention;maple mesos I would let nothing come between me and the subject in hand.maple story power leveling I would remember that a good skater never tries to skate in two directions at once.billig wow gold The habit of attention becomes part of our life, if we begain early enough. I often hear grown up people say maple story items“ I could not fix my attention on the sermon or book, although I wished to do so” , wow powerlevelingand the reason is, the habit was not formed in youth. If I were to live my life over again,wow leveling I would pay more attention to the cultivation of the memory. I would strengthen that faculty by every possible means,wow power leveling and on every possible occasion.maplestory powerleveling It takes a little hard work at first to remember things accurately;cheap archlord gold but memory soon helps itself, and gives very little trouble. It only needs early cultivation to become a power.

he habit of attention becomes part of our life, if we begain early enough. I often hear grown up people say
Gold für WOW
Gold für World of Warcraft

Post a Comment

About me

  • I'm Martin's blog 馬汀的部落格
  • From 中壢市, 桃園縣, Taiwan
  • -----BEGIN GEEK CODE BLOCK----- Version: 3.1 Comment: For info see http://www.geekcode.com GC/CS/CC/E/IT/TW d- s a C++++ L++++ P+ L++++ E--- W+++ N++ o+ K- w+++ O- M- V- PS+ PE++ Y+ PGP+ t 5- X++ R- tv- b+++ DI+ D-- G e+++ h+ r+ y+ z? ------END GEEK CODE BLOCK------ /**************************** 旅行是我生命的動力 它的樂趣從計劃旅行開始 我樂於分享旅行及Linux Kernel上的每一件事. ****************************/
My profile