I’m writing a script that applies various find and replace operations on a single text file using TextWrangler.
It’s my first time experimenting with GREP regular expressions and I’m struggling to get the script to find the data I’m wanting to process.
The text file consists of lines like this:
The vertical bars separate the data into columns. The goal is to create a find and replace rule that will find a column containing
“C/O 6.99”, remove the "C/O " and move just the numbers to the right most column, which will be empty.
So, for clarity:
This will need to be able to search out and alter similar lines that contain different numerical values which may
contain 2, 1 or 0 decimal places and whole values of up to 3 digits.
So the numbers could range from “999.99” to “1” or even just the decimal e.g. “.89”
Also sometimes the number will be preceded by a “£” as they are product prices, but this does not always appear.
The “C/O” always appears.
I’ve been using the standard TextWrangler ‘replace’.
I’m not sure if you’d class this as an AppleScript or TextWrangler post but I’m running out of places to ask!
Any advice or suggestions would be appreciated.
Thank you in advance!