[Insight-users] bash script to search example files for terms

Luis Ibanez luis.ibanez at kitware.com
Mon Oct 12 15:26:06 EDT 2009


Hi Darren,

This is really useful !

Thank you for sharing it.

Do you see any reason for not adding this to the CVS
repository and distribute it along with ITK ?

Please let us know,


    Thanks


          Luis


---------------------------------------
On Mon, Oct 12, 2009 at 2:15 PM, Darren Weber
<darren.weber.lists at gmail.com> wrote:
>
> This is a short bash script (grep does the work) to search for terms in the
> InsightToolkit example files.  It's a convenience wrapper that stores the
> path to the example files (.cxx in this case), the syntax of the grep call,
> and allows multiple terms to be given at once.  Modify the example search
> path for your purposes (it could be modified to search for the tcl or python
> examples too).  Modify the grep call as you like.
>
> #### BEGIN SCRIPT
> #!/bin/bash
>
> if [ $# -lt 1 ]; then
>     echo "$0 'search term' ['search term' ...]"
>     exit 1
> fi
>
> # Search the CXX files
> itkExamplePath="/opt/local/share/InsightToolkit/examples/*/*.cxx"
> echo "Searching ITK .cxx files in: ${itkExamplePath}"
>
> for term in $@; do
>     echo
>     echo "Search term: ${term}"
>     grep -l -E -e ${term} ${itkExamplePath}
> done
> #### END SCRIPT
>
> This is an example call on my platform:
>
> $ itkSearchExamples.bash 'TransformWriter' 'TransformReader'
> Searching ITK .cxx files in:
> /opt/local/share/InsightToolkit/examples/*/*.cxx
>
> Search term: TransformWriter
> /opt/local/share/InsightToolkit/examples/IO/TransformReadWrite.cxx
>
> Search term: TransformReader
> /opt/local/share/InsightToolkit/examples/IO/TransformReadWrite.cxx
> /opt/local/share/InsightToolkit/examples/Registration/DeformableRegistration14.cxx
> /opt/local/share/InsightToolkit/examples/Registration/DeformableRegistration8.cxx
>
> Take care,
> Darren
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list