# # saved screen from mostly-grep examples projected during CS 279 # Week 7 Lecture 1 # experiment: I'm putting lines of -'s before and after the examples, # to see if it helps with readability; --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ more animals.txt oink meow meow oink meow I am moinking next week. oink la la la la oink 1 blank after this oink --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep oink animals.txt oink meow oink meow I am moinking next week. oink la la la la oink 1 blank after this oink --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ emacs animals.txt [added line with o i n k ...to show it wouldn't be matched by pattern oink] [1]+ Stopped emacs animals.txt --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep oink animals.txt oink meow oink meow I am moinking next week. oink la la la la oink 1 blank after this oink --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep oink oink oink meow ^C --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep 'cheap at $9\.98' cheap at $9.98 cheap at $9.98 cheap at $9998 ^C --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep \\ grep: Trailing backslash --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep "\\" grep: Trailing backslash --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep '\\' moo moo\moo moo\moo ^C --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep '\' grep: Trailing backslash --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep 3.5 345 345 3.5 3.5 3a5 3a5 3ab5 35 ^C --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep 3\.5 3.5 3.5 3m5 3m5 ^C --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep "3\.5" 3.5 3.5 3m5 345 123.567 123.567 ^C --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ more clicker1-2.txt AB mooAeB mooABmeow AmB mooAmBmeow AmooB --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep A.B clicker1-2.txt mooAeB AmB mooAmBmeow --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ more animals.txt oink o i n k meow meow oink meow I am moinking next week. oink la la la la oink 1 blank after this oink --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep oink animals.txt oink meow oink meow I am moinking next week. oink la la la la oink 1 blank after this oink --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep ^oink animals.txt oink oink la la --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep oink$ animals.txt oink la la oink --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep "oink $" animals.txt 1 blank after this oink --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep "cost is $9" cost is $9 cost is $9 cost is $9 and that is a bargain cost is $9 and that is a bargain ^C --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep moo^moo moo^moo moo^moo my moo^moony moon my moo^moony moon moony ^ ^C --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep [moxie]* m m mmmmm mmmmm moo moo moomooox moomooox abcd abcd ^C --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep m[moxie]* moo moo oom oom oof mox mox ox oxie oxiem oxiem m m moxo moxo moxo fffff moxo fffff ^C --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ emacs clicker3.txt zabc ac abc abbbc abbbcdef abdc --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep ^ab*c clicker3.txt ac abc abbbc abbbcde --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$ grep ^[^0-9]$ f f 9 6 g g ^C --------------------------------------------------------------------- Math-Tuttle-OSX:279lect07-1-play smtuttle$