On Apr 26, 2013, at 13:02, Gregor Knell <
grego...@gmail.com> wrote:
> There are over 15,000 lines that look similar to these:
> <coordinates>34.14135381,-118.23758366</coordinates>
> ...
______________________________________________________________________
Hey Gregor,
You can use Applescript for such a task, but since this is basically a straightforward find/replace you could also use a regex in the find dialog — or for something more reusable a text filter.
-------------------------------------------------------------------------------------------
#! /usr/bin/env perl
use v5.12; use strict; use warnings;
#----------------------------------------
while (<>) {
if ( m{([[:blank:]]*<coordinates>)(\d+\.\d+)(,)(-?\d+\.\d+)(</coordinates>)}i) {
say "$1$4$3$2$5";
} else {
print;
}
}
-------------------------------------------------------------------------------------------
Save the above as a file in:
~/Library/Application Support/TextWrangler/Text Filters/
Run it from the menu: {Text} --> {Apply Text Filter} or assign it a keyboard shortcut.
Be sure and test on a COPY of your data.
--
Best Regards,
Chris