SSブログ

find -exec と find + xargs [FreeBSD]

ソースから、特定のキーワードを探すときは

$ find . -name '*.c' -exec  grep -H keyword {} \;


とかしてる。
今回、複数のディレクトリにまたがるソースの行数を wc で数えたくなった。
1ファイルずつ数えると合計が出ない。
確か、xargs っていうのを使うんだったなぁ・・・あった
http://sonic64.com/2003-11-07.html

$ find . -name '*.c' -print |xargs wc


とすれば良い。
ただ、xargs を使う場合は、コマンド行の長さで限界があるところに注意だな。

(追記 2007/4/2)
最近は、 -print0 とか -0 をつけるのが吉らしい
http://www.otsune.com/diary/2007/03/29/1.html#200703291


nice!(0)  コメント(4)  トラックバック(0) 
共通テーマ:パソコン・インターネット

nice! 0

コメント 4

Ellemossy

Levitra 20mg Cost Viagra Costo Attuale <a href=http://cialisong.com>generic cialis overnight delivery</a> Cialis 20mg 12 St Generic Cash On Delivery Pyridium Real Pharmacy Amoxicillin For Child'S Ear Infection
by Ellemossy (2019-06-14 02:04) 

Auststeend

Buy Topamax Online Without Doctor 5mg Cialis Online <a href=http://buycialonline.com>cheapest cialis</a> Cialis One Day Terapia Ou Acheter Du Levitra Pfizer Levitra Composicion
by Auststeend (2019-06-17 07:19) 

Ellemossy

Mexico Pharmacies That Sell Celebrex Amoxicillin Antibiotic Side Effects For Infants <a href=http://tadalaffbuy.com>cialis online</a> Valtrex Online Cheap
by Ellemossy (2019-07-14 12:02) 

Ellemossy

Cvs Propecia Male Pattern Baldness Naturally Occurring Amoxicillin Alert <a href=http://orderciali.com>generic cialis overnight delivery</a> Doxycycline Without Prescription
by Ellemossy (2019-07-23 14:33) 

コメントを書く

お名前:
URL:
コメント:
画像認証:
下の画像に表示されている文字を入力してください。

Facebook コメント

トラックバック 0