Using csh / awk / sed to compare database sizes in a txt file
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)
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
Last edited by radoulov; 09-16-2011 at 01:02 PM..
Reason: Code tags, please!
Is there a command that will return the name of the largest file within a directory? If so, can I set the returned filename into a variable? (4 Replies)
hi
ls -l * | sed 's/\+/ /g' | cut -f5 -d " " >out1
ls -l * | sed 's/\+/ /g' | cut -f5 -d " " >out2
diff out1 out2
i tried this it will work fine and i can see difference
but i need a script which should neglect, if the difference b/w files is small
and
it should display... (5 Replies)
I need to get a file size and compare it to a previous day file size. If it's larger or smaller by 50 percent I'll replace the new with the old. I know how to get the file sizes but do not know how to calculate if it's 50 percent difference.
Thanks for your help. (2 Replies)
Hi everyone!
I need to compare two file sizes.
One of them (size) will be stored in a flat file and the other coming from a listed file.
I can now get the first file size using:
SIZE=`ls -l $DOCTYPE | awk '{print $5}'`
1. How can I store this value in a flat file?
2. How... (2 Replies)
I need to write a bash script larger X Y that compares the sizes of two specified files X and Y,
and reports which file is larger. For example, if X is larger, the output should be "File X is larger",
while if Y is larger, the output should be "File Y is larger".
If the files are exactly the... (3 Replies)
Hello folks
I have a txt file of information about journal articles from different fields. I need to convert this information into a format that is easier for computers to manipulate for some research that I'm doing on how articles are cited. The file has some header information and then details... (8 Replies)
Hi dears
i have text file like this:
INPUT.txt
001_1_173 j nuh ]az
001_1_174 j ]esma. nuh ]/.xori
.
.
. and have another text
like this
TABLE.txt
j j
nuh word1... (6 Replies)
Hello,
I currently have very little experience with Shell scripting and trying to create a script for the purpose of collecting the size of a couple sizes on 4 different Hosts. The Idea is to collected the information from the files in which the script is kicked off on, store the values into... (17 Replies)