If it's sufficient to use the following criteria to locate the profile:
<key>Name</key>
<string>iOS Team Provisioning Profile: *</string>
you can scan the directory using awk. This one-liner will find the first file that contains the name starting with "iOS Team".
awk 'BEGIN{e=1;pat="<string>"tolower("iOS Team")}{cur=tolower($0);if(cur~pat &&prev~/<key>name<\/key>/){print FILENAME;e=0;exit};if($0!~/^\s*$/)prev=cur}END{exit e}' *
Here's a script that also returns the first match, but is easier to work with.
#!/bin/bash
if [ $# != 1 ] ; then
echo Usage: $0 \<start of provisioning profile name\>
exit 1
fi
read -d '' script << 'EOF'
BEGIN {
e = 1
pat = "<string>"tolower(prov)
}
{
cur = tolower($0)
if (cur ~ pat && prev ~ /<key>name<\\/key>/) {
print FILENAME
e = 0
exit
}
if ($0 !~ /^\s*$/) {
prev = cur
}
}
END {
exit e
}
EOF
awk -v "prov=$1" "$script" *
It can be called from within the profiles directory, $HOME/Library/MobileDevice/Provisioning Profiles:
~/findprov "iOS Team"
To use the script, save it to a suitable location and remember to set the executable mode; e.g., chmod ugo+x