I'm scanning for all shell scripts on my server, and are doing this by the following command:
find / -type f -exec file --mime-type {} \; | grep "text/x-shellscript"
This is working fine, and here is a sample output from this:
/lib/udev/hwclock-set: text/x-shellscript
/lib/init/bootclean.sh: text/x-shellscript
/etc/network/if-up.d/openssh-server: text/x-shellscript
/etc/network/if-up.d/mountnfs: text/x-shellscript
Now, I want to work on the filenames, and try to use awk for this:
find / -type f -exec file --mime-type {} \; | grep "text/x-shellscript" | awk -F: '{ print $1 }'
This however, does not produce any output. Ive tried redirecting pipes etc, but here I've hit the wall.
Anyone have an idea of what I'm doing wrong?
echo "/etc/network/if-up.d/mountnfs: text/x-shellscript" | awk -F: '{ print $1 }'? – Daniel Beck Oct 16 '11 at 13:51find / -type f -exec file --meta-type {} \; | grep "text/x-shellscript" 2>&1 | awk -F: '{ print $1 }'– Daniel Beck Oct 16 '11 at 14:03grepthere. – JdeBP Oct 16 '11 at 15:41