On 05/19/2021, at 08:30, Miguel Perez <[email protected] 
<mailto:[email protected]>> wrote:
> On a daily basis I get an XML file. This file contains information about some 
> dossiers. I need to extract two elements from each dossier: (1) a URL to 
> download associated images, and (2) the dossier's name.


Hey Miguel,

I don't think that automator action will take a file as input, but I'm not 
absolutely certain.

In any case I think you should bite the bullet and learn a little more shell 
scripting – since you're already using wget.

I'm just playing around here a bit to show you what's easily accomplished.

You can run these conveniently in a BBEdit worksheet to see what they do.


filePath=~/Downloads/MA_NO_2021_05_011.xml

# Prints the found pattern in the given text file.
grep -E -o -e 'http.+ImagenFichaServlet[^]]+' "$filePath"


filePath=~/Downloads/MA_NO_2021_05_011.xml

# Prints the line after the found pattern along with the found text.
grep -E -A 1 -o 'Denominación' "$filePath"


filePath=~/Downloads/MA_NO_2021_05_011.xml

# Prints the line after the found pattern then deletes the detritus.
sed -n '/Denominación/{n;p;}' "$filePath" \
| sed -E 's!.+\[|\].+!!g'


The output of these is easily redirected to files.

Your wget downloader can follow the extract-text segments.

You can rename your files using wget itself, or you can follow-on with a rename 
script.

Personally I'd do all of this in Bash.

That said let me recommend Keyboard Maestro 
<https://www.keyboardmaestro.com/main/> to you as a great tool for getting real 
work done on a Mac. In my expert opinion it's currently the Best-of-Breed Mac 
Automation Utility. (Commercial  $36.00 US.)

It's a bit like Automator on steroids, and I've been a happy superuser for 
about 17 years now.

Like BBEdit it runs 24/7 on my Macs.

--
Best Regards,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/300572B7-45BA-4BE0-912E-41060D2DADF8%40gmail.com.

Reply via email to