Showing posts with label shell. Show all posts
Showing posts with label shell. Show all posts

Tuesday, 29 July 2008

Handy foreach + grep

Today I wanted to list a bunch of python files that used a setValue command.

To get some colour in the output

--colour=always

Ignore case

-i

Show line number

-n

Put it all together

grep --colour=always -i -n setValue

And combine with the foreach.

foreach j (*)
foreach? echo $j
foreach? cat $j |grep --colour=always -i -n setValue
foreach? end

Lovely.

Saturday, 24 May 2008

find

Find command example

find / -name "*emacs*" -print