grep
eharetea

The grep command comes in handy for parsing files.

Parsing files and extracting data.

Date Created:Friday December 29th, 2006 03:41 AM
Date Modified:Wednesday July 30th, 2008 04:54 PM

GREP
ls | grep p

STARTS WITH perl
ls | grep ^perl

ENDS WITH P
ls | grep p$

Prints line matching string:
sed -n '/ray_shader/p' ifd.ifd
grep ray_shader ifd.ifd

grep '*' ifd.ifd
this will look for the "*" character, instead of it having its shell meaning

patterns
grep 'gr[ea]y' colors.cmd

grep -i 'opdef' ifd.ifd
caps insensitive

grep -v 'UNIX' intro
lines that dont have UNIX

grep -l  'opdef' *.ifd
prints the files that contain match, but not printing the line

grep -n 'opdef' ifd.ifd
prints the lines preceded by the line numbers