|
想找出linux 目录下目录层次为N的所有文件。
当N为7时,可以看到源码树中对应的文件如下:
(命令:find -mindepth 7 -maxdepth 7)
[root@~/linux-2.6.23.8]#find -mindepth 7 -maxdepth 7
./include/config/x86/acpi/cpufreq/proc/intf.h
./include/config/arch/may/have/pc/fdc.h
./include/config/blk/dev/3w/xxxx/raid.h
./include/config/cpu/freq/default/gov/performance.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_timer_grp_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_spu_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_scrc_out_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_out_extra_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_mpu_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_dmc_in_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_in_extra_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_in_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_cpu_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_mpu_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_reg_space_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_scrc_in_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_dmc_out_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_crc_par_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_sap_in_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_version_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_trigger_grp_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_sap_out_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_fifo_out_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_spu_defs_asm.h
./include/asm-cris/arch-v32/hwregs/iop/asm/iop_sw_cfg_defs_asm.h
现在可以通过如下方式找出./include/asm-cris/arch-v32/hwregs/iop/asm/目录中的所有文件名:
step1: [root@~/linux-2.6.23.8]#echo "./include/asm-cris/arch-v32/hwregs/iop/asm/" | wc -m
44
step2: 使用cut命令
最终的命令为:
[root@~/linux-2.6.23.8]#find -mindepth 7 -maxdepth 7 | cut -c44-
.h
rmance.h
iop_timer_grp_defs_asm.h
iop_sw_spu_defs_asm.h
iop_scrc_out_defs_asm.h
iop_fifo_out_extra_defs_asm.h
iop_sw_mpu_defs_asm.h
iop_dmc_in_defs_asm.h
iop_fifo_in_extra_defs_asm.h
iop_fifo_in_defs_asm.h
iop_sw_cpu_defs_asm.h
iop_mpu_defs_asm.h
iop_reg_space_asm.h
iop_scrc_in_defs_asm.h
iop_dmc_out_defs_asm.h
iop_crc_par_defs_asm.h
iop_sap_in_defs_asm.h
iop_version_defs_asm.h
iop_trigger_grp_defs_asm.h
iop_sap_out_defs_asm.h
iop_fifo_out_defs_asm.h
iop_spu_defs_asm.h
iop_sw_cfg_defs_asm.h |
|