grep 指定文件类型搜索特定字符串

 grep -rin "ogg" --include "*.prop" ./

./system.prop:51:#codecs:(PARSER_)AAC AC3 AMR_NB AMR_WB ASF AVI DTS FLV 3GP 3G2 MKV MP2PS MP2TS MP3 OGG QCP WAV FLAC AIFF APE DSD DivX
./vendor/build.prop:18:ro.config.alarm_alert=AL_DROID_03.ogg
./vendor/build.prop:19:ro.config.ringtone=RED_Classic.ogg
./vendor/build.prop:20:ro.config.notification_sound=pixiedust.ogg
/system # find ./ -name '*.prop'| xargs grep'ogg'                                                                                                                                              
/system # cd vendor/                                                                                                                                                                        /system/vendor # find ./ -name '*.prop'| xargs grep 'ogg'                                                                                                                                       
./build.prop:ro.config.alarm_alert=AL_DROID_03.ogg
./build.prop:ro.config.ringtone=RED_Classic.ogg
./build.prop:ro.config.notification_sound=pixiedust.ogg
jordan@jordan-OptiPlex-7020:~/flash$ find . -name \*.c -print0 -or -name \*.h -print0 | xargs -0 grep "hello"
./log/t.h:hello
./log/t.h:hello world
./log/sfjin.c:hello worldjing
jordan@jordan-OptiPlex-7020:~/flash$ grep -rin "hello" --include "*.h" --include="*.c"
log/t.h:4:hello
log/t.h:5:hello world
log/sfjin.c:1:hello worldjing

 

你可能感兴趣的:(ubuntu下的开发)