Simple string searching in a text file

I'm sure this is dead simple, but I haven't found a good example yet. I have an XML file that is created by a Garmin GPS watch that I wear when I'm running or biking. I'd like to automate the process of archiving these files by workout type whenever they are downloaded from my watch.
Here's what the top part of one of these .TCX files looks like:
Notice the
These .TCX files are not indexed by Spotlight, so I can't use a simple "Contents contains…" condition. It seems like a simple embedded script would be just right here.
What would that script look like?
To sum up, I have two conditions...
1. Extension is TCX
2. File contains the text "Biking"
It's #2 that's giving me grief.
Any suggestions?
Here's what the top part of one of these .TCX files looks like:
- Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<TrainingCenterDatabase xmlns="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2 http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd">
<Activities>
<Activity Sport="Biking">
<Id>2012-08-04T21:03:31Z</Id>
.
.
.
many more lines of XML text
Notice the
- Code: Select all
<Activity Sport="Biking">
These .TCX files are not indexed by Spotlight, so I can't use a simple "Contents contains…" condition. It seems like a simple embedded script would be just right here.
What would that script look like?
To sum up, I have two conditions...
1. Extension is TCX
2. File contains the text "Biking"
It's #2 that's giving me grief.
Any suggestions?