I have a dirty report file that contains improperly formatted negative numbers. The ultimate goal is to import these to Excel for analysis. I am using BBEdit to clean the report before importing into Excel. I would like to create an apple script to loop through the report and move the "-" from the back of the number to the front.
Dirty Report Example Rows:
B-EXCAL 02 3684 2.0000- 49.02- 108.00- 58.98- 54.6-
B-MISMH 09-3300 33.0000 722.91 1353.00 630.09 46.6
Desired output:
B-EXCAL 02 3684 -2.0000 -49.02 -108.00 -58.98 -54.6
B-MISMH 09-3300 33.0000 722.91 1353.00 630.09 46.6
I have JavaScript and VBScript experience so I imaging the script working something like this psudo script:
Get contents of current window from BBEdit
for each word in contents
if char(len(word)) = "-"
newWord = "-" + rightTrim(word, 1)
replace(word, newWord)
end if
end for
end
This is my first experience with AppleScript and I am at a complete loss.
Thanks for the help/