<br><br><div class="gmail_quote">On Mon, Oct 12, 2009 at 8:09 PM, Darren Weber <span dir="ltr"><<a href="mailto:darren.weber.lists@gmail.com">darren.weber.lists@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><br><div class="gmail_quote"><div class="im">On Mon, Oct 12, 2009 at 6:40 PM, Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>></span> wrote:<br></div>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Darren,<br>
<br><div class="im">
Thanks for the script.<br>
<br>
It has now been committed to the CVS repository as<br>
<br>
Insight/Examples/SearchScript.sh<br>
<br></div></blockquote><div><br>OK ;-)<br><br> </div><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
---<br>
<br>
The second script,<br>
are you suggesting it as a separate script ?<br>
or as an improvement to the first one ?<br></blockquote></div><div><br><br>I guess it's an improvement, as I prefer the second script, but anyone doing only .cxx work might prefer not to see any .tcl or .py files returned.<br>
<br></div></div></blockquote><div><br><br>This may be another improvement, using 'find' to get a list of all the files to search.<br><br><br>#######BEGIN SCRIPT<br><span style="font-family: courier new,monospace;">#!/bin/bash</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">if [ $# -lt 1 ]; then</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> echo "$0 'search term' ['search term' ...]"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> exit 1</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">fi</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">itkExamplePath="/opt/local/share/InsightToolkit/examples"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">itkTestingPath="/opt/local/share/InsightToolkit/testing"</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">for term in $@; do</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> echo</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> echo "Search term: ${term}"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> for itkPath in "${itkExamplePath}" "${itkTestingPath}" ; do</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if [ ! -d ${itkPath} ]; then</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> echo "Path not found: ${itkPath}"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> fi</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> echo "Searching ITK files in: ${itkPath}"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> cxxFiles=$(find ${itkPath} -name "*.cxx")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> grep -l -E -e ${term} ${cxxFiles}</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> tclFiles=$(find ${itkPath} -name "*.tcl")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> grep -l -E -e ${term} ${tclFiles}</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> pyFiles=$(find ${itkPath} -name "*.py")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> grep -l -E -e ${term} ${pyFiles}</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> done</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">done</span><br style="font-family: courier new,monospace;">
</div>#######END SCRIPT</div><br><br><br><br>