Hello,
I have an output file showing database sizes across the 3 environments that I use (LIVE, TEST & DEVELOPMENT).
I am trying to write a script that lets me know if the size of a db on one environment is different to its corresponding db on the other environments.
Here is an example of the file......(Name Size Environment)
stevie_db 13000 LIVE
stevie_db 13000 TEST
stevie_db 14000 DEVELOPMENT
john_db 25000 LIVE
john_db 25000 TEST
john_db 25000 DEVELOPMENT
I want to compare database sizes & flag up any databases that are a different size in any of the environments. So in the above example, the database stevie_db will be flagged up (because it is a different size in DEVELOPMENT). Maybe we could append an asterisk to any line that matches our criteria, to show it is different.
I imagine the general syntax would be something along the lines of
If $1 on line 1 = $1 on any other line
Compare $2 on lines 1 and the matching line, flag up an error if they are different sizes.
Move on to Line 2 (and so on).
Is this something that could be done in awk?
Any help would be really appreciated.
Cheers,
Stevie