grep

From NetBSD Wiki

Jump to: navigation, search

The grep(1) utility can be used to print lines matching a pattern.

Examples

Search for text in files:

$ grep smbd /etc/*.conf
/etc/rc.conf:smbd=YES

Check the number of logged lines from a daemon:

$ grep -c upsd /var/log/messages
42

Check the status of your network interfaces (this could be an handy alias):

$ ifconfig -au | grep -E 'media|status'
       media: Ethernet autoselect (100baseTX full-duplex)
       status: active
       media: Ethernet autoselect (100baseTX full-duplex)
       status: active

See also

View source code (Please report any bugs or suggestions here).

Retrieved from "http://wiki.netbsd.se/grep"
Personal tools