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

Andrew Maclean andrew.amaclean at gmail.com
Mon Oct 12 23:46:32 EDT 2009


Ok, I'll do some testing and then put it in VTK/Examples

Andrew


On Tue, Oct 13, 2009 at 2:31 PM, Darren Weber
<darren.weber.lists at gmail.com> wrote:
>
>
> On Mon, Oct 12, 2009 at 8:09 PM, Darren Weber <darren.weber.lists at gmail.com>
> wrote:
>>
>>
>> On Mon, Oct 12, 2009 at 6:40 PM, Luis Ibanez <luis.ibanez at kitware.com>
>> wrote:
>>>
>>> Hi Darren,
>>>
>>> Thanks for the script.
>>>
>>> It has now been committed to the CVS repository as
>>>
>>>         Insight/Examples/SearchScript.sh
>>>
>>
>> OK ;-)
>>
>>
>>>
>>> ---
>>>
>>> The second script,
>>> are you suggesting it as a separate script ?
>>> or as an improvement to the first one ?
>>
>>
>> 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.
>>
>
>
> This may be another improvement, using 'find' to get a list of all the files
> to search.
>
>
> #######BEGIN SCRIPT
> #!/bin/bash
>
> if [ $# -lt 1 ]; then
>     echo "$0 'search term' ['search term' ...]"
>     exit 1
> fi
>
> itkExamplePath="/opt/local/share/InsightToolkit/examples"
> itkTestingPath="/opt/local/share/InsightToolkit/testing"
>
> for term in $@; do
>     echo
>     echo "Search term: ${term}"
>     for itkPath in "${itkExamplePath}" "${itkTestingPath}" ; do
>         if [ ! -d ${itkPath} ]; then
>             echo "Path not found: ${itkPath}"
>         fi
>         echo "Searching ITK files in: ${itkPath}"
>         cxxFiles=$(find ${itkPath} -name "*.cxx")
>         grep -l -E -e ${term} ${cxxFiles}
>         tclFiles=$(find ${itkPath} -name "*.tcl")
>         grep -l -E -e ${term} ${tclFiles}
>         pyFiles=$(find ${itkPath} -name "*.py")
>         grep -l -E -e ${term} ${pyFiles}
>     done
> done
> #######END SCRIPT
>
>
>
>
> _____________________________________
> 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
>
>



-- 
___________________________________________
Andrew J. P. Maclean
Centre for Autonomous Systems
The Rose Street Building J04
The University of Sydney  2006  NSW
AUSTRALIA
Ph: +61 2 9351 3283
Fax: +61 2 9351 7474
URL: http://www.acfr.usyd.edu.au/
___________________________________________


More information about the Insight-users mailing list