On Sun, 2003-09-21 at 00:48, bob bob wrote: > Any of you guys any good as scripting? > I'm trying to do a smarter version of this : > > ls -lR /lib/modules/*/kernel/ >> /etc/modules.autoload.d/kernel-2.4 ... > /lib/modules/2.4.20-gentoo-r6/kernel/arch/i386/kernel: > total 28 > -rw-r--r-- 1 root root 19016 Sep 8 06:57 apm.o > -rw-r--r-- 1 root root 3044 Sep 8 06:57 cpuid.o > -rw-r--r-- 1 root root 3848 Sep 8 06:57 msr.o > > > Now out of that all I want is : > apm > cpuid > msr
If you only wan the files you can use find with a -type of f: find /lib/modules/*/kernel/* -type f -printf "%f\n" |sed 's/.o//g' Although since your redirecting the output to modules.autoload/kernel-2.4 I would think that you might want to restrict the output to uniq items. Otherwise if you have more than one tree in /lib/modules you'll probably end up with duplicate modules. So something like: find /lib/modules/*/kernel/* -type f -printf "%f\n" |sed 's/.o//g' | sort | uniq will prevent duplicate module entries. Good Luck, Doug
signature.asc
Description: This is a digitally signed message part