<br><br><div class="gmail_quote">On Mon, Oct 12, 2009 at 6:40 PM, Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.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;">
Hi Darren,<br>
<br>
Thanks for the script.<br>
<br>
It has now been committed to the CVS repository as<br>
<br>
Insight/Examples/SearchScript.sh<br>
<br></blockquote><div><br>OK ;-)<br><br> </div><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><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><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5"><br>
<br>
Please let us know,<br>
<br>
<br>
Thanks<br>
<br>
<br>
Luis<br>
<br>
<br>
----------------------------<br>
On Mon, Oct 12, 2009 at 4:15 PM, Darren Weber<br>
<<a href="mailto:darren.weber.lists@gmail.com">darren.weber.lists@gmail.com</a>> wrote:<br>
><br>
> Hi Luis,<br>
><br>
> Please feel free to distribute it with the LGPL license (or a BSD license,<br>
> or something that is compatible with the ITK license and general OSI<br>
> principles).<br>
><br>
> For a more portable solution, the itk*Path variables might be obtained<br>
> automatically (how?). The search path could be an input parameter (but that<br>
> almost defeats the convenience of this bash wrapper around a grep process).<br>
><br>
> The grep command options list the files where the search term is found (not<br>
> the lines of those files where the search term occurs). For a bit more<br>
> value, it's possible to modify the script so that the entire grep loop<br>
> returns an array of file paths, which could be piped into something like:<br>
> less -p ${searchTerm} ${fileArray}[@]<br>
> Then less would provide the means to page through the files.<br>
><br>
> Here is another variation on the same thing - this one searches the testing<br>
> path and it includes the .tcl and .py example files in the search. It might<br>
> be called 'itkSearchFiles.bash' ?<br>
><br>
> ###### BEGIN SCRIPT<br>
> #!/bin/bash<br>
><br>
> if [ $# -lt 1 ]; then<br>
> echo "$0 'search term' ['search term' ...]"<br>
> exit 1<br>
> fi<br>
><br>
> itkExamplePath="/opt/local/share/InsightToolkit/examples"<br>
> itkTestingPath="/opt/local/share/InsightToolkit/testing/Code"<br>
><br>
> for term in $@; do<br>
> echo<br>
> echo "Search term: ${term}"<br>
> for itkPath in "${itkExamplePath}" "${itkTestingPath}" ; do<br>
> if [ ! -d ${itkPath} ]; then<br>
> echo "Path not found: ${itkPath}"<br>
> fi<br>
> echo "Searching ITK files in: ${itkPath}"<br>
> grep -l -E -e ${term} ${itkPath}/*/*.cxx<br>
> grep -l -E -e ${term} ${itkPath}/*/*.tcl<br>
> grep -l -E -e ${term} ${itkPath}/*/*.py<br>
> done<br>
> done<br>
> ###### END SCRIPT<br>
><br>
><br>
> Take care,<br>
> Darren<br>
><br>
><br>
><br>
><br>
><br>
><br>
> On Mon, Oct 12, 2009 at 12:26 PM, Luis Ibanez <<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>><br>
> wrote:<br>
>><br>
>> Hi Darren,<br>
>><br>
>> This is really useful !<br>
>><br>
>> Thank you for sharing it.<br>
>><br>
>> Do you see any reason for not adding this to the CVS<br>
>> repository and distribute it along with ITK ?<br>
>><br>
>> Please let us know,<br>
>><br>
>><br>
>> Thanks<br>
>><br>
>><br>
>> Luis<br>
>><br>
>><br>
>> ---------------------------------------<br>
>> On Mon, Oct 12, 2009 at 2:15 PM, Darren Weber<br>
>> <<a href="mailto:darren.weber.lists@gmail.com">darren.weber.lists@gmail.com</a>> wrote:<br>
>> ><br>
>> > This is a short bash script (grep does the work) to search for terms in<br>
>> > the<br>
>> > InsightToolkit example files. It's a convenience wrapper that stores<br>
>> > the<br>
>> > path to the example files (.cxx in this case), the syntax of the grep<br>
>> > call,<br>
>> > and allows multiple terms to be given at once. Modify the example<br>
>> > search<br>
>> > path for your purposes (it could be modified to search for the tcl or<br>
>> > python<br>
>> > examples too). Modify the grep call as you like.<br>
>> ><br>
>> > #### BEGIN SCRIPT<br>
>> > #!/bin/bash<br>
>> ><br>
>> > if [ $# -lt 1 ]; then<br>
>> > echo "$0 'search term' ['search term' ...]"<br>
>> > exit 1<br>
>> > fi<br>
>> ><br>
>> > # Search the CXX files<br>
>> > itkExamplePath="/opt/local/share/InsightToolkit/examples/*/*.cxx"<br>
>> > echo "Searching ITK .cxx files in: ${itkExamplePath}"<br>
>> ><br>
>> > for term in $@; do<br>
>> > echo<br>
>> > echo "Search term: ${term}"<br>
>> > grep -l -E -e ${term} ${itkExamplePath}<br>
>> > done<br>
>> > #### END SCRIPT<br>
>> ><br>
>> > This is an example call on my platform:<br>
>> ><br>
>> > $ itkSearchExamples.bash 'TransformWriter' 'TransformReader'<br>
>> > Searching ITK .cxx files in:<br>
>> > /opt/local/share/InsightToolkit/examples/*/*.cxx<br>
>> ><br>
>> > Search term: TransformWriter<br>
>> > /opt/local/share/InsightToolkit/examples/IO/TransformReadWrite.cxx<br>
>> ><br>
>> > Search term: TransformReader<br>
>> > /opt/local/share/InsightToolkit/examples/IO/TransformReadWrite.cxx<br>
>> ><br>
>> > /opt/local/share/InsightToolkit/examples/Registration/DeformableRegistration14.cxx<br>
>> ><br>
>> > /opt/local/share/InsightToolkit/examples/Registration/DeformableRegistration8.cxx<br>
>> ><br>
>> > Take care,<br>
>> > Darren<br>
>> ><br>
>> ><br>
>> > _____________________________________<br>
>> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>> ><br>
>> > Visit other Kitware open-source projects at<br>
>> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> ><br>
>> > Please keep messages on-topic and check the ITK FAQ at:<br>
>> > <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>> ><br>
>> > Follow this link to subscribe/unsubscribe:<br>
>> > <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
>> ><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br>