![]() I would just get a directory listing, one file per line, and use that as a starting point. Then, use BBEdit's "grep" facility to set the target name to be what you want, and to add in the "mv" command. Then save that BBEdit file as "run.sh" and do just that: "sh run.sh". Originally, I misunderstood your post with respect to those suffixes. That adds another layer of complexity and requires a regular expression to solve. You may even need to use the "regex" mode in BBEdit. This also makes the Perl solution a little bit more complicated than I would normally suggest for someone who hasn't used it before. Don't get me wrong, Perl is still totally superior to AppleScript. It is just that the problem, as you've defined it, is overly complex for the actual task to be performed. That's my I recommend you do it all in BBEdit. ![]() I would use BBEdit myself for such a task. I wouldn't go through the effort to write a Perl script unless I really needed to do something more complicated, like read a CSV file. If you didn't already know, and it sounds like you didn't, CSV is a truly awful format. People, especially those who should know better, use it way too often. If this is your own data, then it's no big deal. But if you didn't create the data, and if it had 600,000 rows instead, then trying to read it without a dedicated CSV parser is just asking for trouble. Spaces, commas, single quotes, double-quotes, empty strings, escapes, escaped escapes, truncations, Unicode, etc. You'll get all of these in the real world. And you'll always have to validate the output. When reading 600,000 lines, it is really easy to only parse 510,000 and not notice it. Then you publish a scientific paper on that data and someone catches it. My $file = shift or die "CSV file not found\n" Awkward!īut alas, Camelot has already posted an Applescript solution, with a fixed input size assumption, and suggested that AppleScript could easily handle it. ![]() # Glob the old name as the shell would do. _ = Open3.capture2('osascript', '-e', completed, itemcnt.
0 Comments
Leave a Reply. |