If you are willing to switch half way through to some kind of spreadsheet application, please, read on.
Using TextWrangler (4.5.11) with grep enabled for searches:
- Start adding line numbers using TextWrangler's -> Text -> Add/Remove line numbers.
- Search for
^[[:digit:]]+ (?!z-index)(.*)$
and replace with \t\1
.
- Search for
^([[:digit:]]+)
and replace with =(\1+7)/9\t
.
- Mark everything and copy.
Sorry - no clue, how to calculate inside TextWrangler. Thus:
- Paste into some spreadsheet application. (Did test with Google table and Excel. Might need to adjust formula if other software is being used.)
- Wait for the formulas to be calculated.
- Mark everything and copy.
- Go back to TextWrangler. Paste replacing original selection.
- Verify the calculations' result to persist.
- Search for
^([[:digit:]]+)\t(\s+z-index: )0;
and replace with \2\1
.
- Verify the file's content (and provide more detail if necessary to address the problem in full; significant chunk of data would facilitate proper testing…).