parsed.org

Tips by tag: grep

Grep: Show only filenames by cygnus on Jun 03, 2005 11:12 AM

You can have grep show only the filenames that matched (instead of showing all lines in those files that matched) by using the -l switch:

$ grep -l SELECT *.sql
file1.sql
file2.sql

grep will only list unique filenames (i.e. a file with two matches will only be listed once).

commandsgrepshellunique
Using 'strings' for Paths in a Binary by xinu on Sep 13, 2005 02:34 PM

If you need to discover on which paths a binary depends, you can sometimes run strings on it and grep for everything starting with a slash:

# strings /usr/sbin/named | grep ^/
/lib/ld-linux.so.2
/etc/named.conf
/etc/rndc.key
/etc/lwresd.conf
/etc/resolv.conf
/var/run/named/named.pid
/var/run/named/lwresd.pid
/dev/null
binaryconfigurationgrepprocessshellstrings
RSS