Bash script getting difference values from files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash script getting difference values from files
# 1  
Old 07-02-2008
Data Bash script getting difference values from files

Hi
I want to write a BASH script.
I have files updated every hour from two platforms.The file names are :
- Falcon_smsCounters_1200020708.log
- Canari_smsCounters_1200020708.log

1200 refers to hour twelve and 020708 to 02 july 2008.

Inside every file i have a list of parameters splitted by :

Falcon_smsCounters_1200020708.log contains for example

parameter 1 : 89026
parameter 2 : 98526
etc...




parameter n : 78954

A new file comes every hour containing the same parameters but different values . So what i want is to extract the difference values (decimal values) between Falcon_smsCounters_ of hour n and file
Falcon_smsCounters_ of hour n-1 and replace them in the newest file which is for hour n
Same method for Canari_smsCounters_1200020708.log
I want them simoulteanously inside this script , i mean to make the difference every hour .

Thanks
# 2  
Old 07-02-2008
just one thought... rather than relying on the date and time embedded in filename, why not consider the last time of modification to find latest files?
# 3  
Old 07-02-2008
Bash scripting and getting difference values

ls -ltr and ????
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Difference between two date values

bash-3.00$ date Tue Oct 13 15:03:54 CEST 2015 start=`date +"%T" | awk -F":" '{print $2,$3}'` echo $start 08 17 end=`date +"%T" | awk -F":" '{print $2,$3}'` echo $end 08 37 how can I get the difference between above both timestamps, Im trying but getting errors: any one please help... (10 Replies)
Discussion started by: sam@sam
10 Replies

2. Shell Programming and Scripting

Bash script deleting my files, and editing files in subdirectories question

#!/bin/bash # name=$1 type=$2 number=1 for file in ./** do if then filenumber=00$number elif then filenumber=0$number fi tempname="$name""$filenumber"."$type" if (4 Replies)
Discussion started by: TheGreatGizmo
4 Replies

3. Shell Programming and Scripting

Query the table and return values to shell script and search result values from another files.

Hi, I need a shell script, which would search the result values from another files. 1)execute " select column1 from table_name" query on the table. 2)Based on the result, need to be grep from .wft files. could please explain about this.Below is the way i am using. #!/bin/sh... (4 Replies)
Discussion started by: Rami Reddy
4 Replies

4. Shell Programming and Scripting

Script to compare 2 files and prints difference as output sidebyside

Hi All, Am trying script to compare 2 files and print the difference found from old file to new file on line by line basis on side by side display. Basically line by line comparision and files may contain blank line as well I know we have compare/diff commands but i don't how to make... (10 Replies)
Discussion started by: Optimus81
10 Replies

5. Homework & Coursework Questions

Script to find difference between 2 files by column

Hi , i am newbie to shell scripting and am trying to do the below job, A shell script to be run with a command like sh Compare.ksh file1.txt file2.txt 1 2 > file3.txt 1 2-are the key columns Consider the delimiter would be Tab or comma File 1: SK TEST NAME MATHS PHYSICS 21 1 AAA... (1 Reply)
Discussion started by: shakthi666
1 Replies

6. Shell Programming and Scripting

Script to find difference between 2 files by column

Hi , i am newbie to shell scripting and am trying to do the below job, A shell script to be run with a command like sh Compare.ksh file1.txt file2.txt 1 2 > file3.txt 1 2-are the key columns Consider the delimiter would be Tab or comma File 1: SK TEST NAME MATHS PHYSICS 21 1... (1 Reply)
Discussion started by: shakthi666
1 Replies

7. Shell Programming and Scripting

script to find whether the difference between two files in only additions but not modifications

i basically have 2 files and sdiff of the files is given below sdiff file1 file 2 control_file < path INDEX < size 613 < mode 0444 ... (1 Reply)
Discussion started by: under_cons
1 Replies

8. Shell Programming and Scripting

Use AWK to check for numeric values? (BASH script)

Hi, I'm quite new to scripting, but know a few AWK statements. I have the following line in my script: hostname=`echo $file | awk 'BEGIN{FS=OFS="."}{$NF=""; NF--; print}'` I use this in my script to rename files, which are similar to this: name.mvkf.mkvfm.mkfvm.1 To the... (4 Replies)
Discussion started by: TauntaunHerder
4 Replies

9. Shell Programming and Scripting

Calculate difference between two successive values

Hi, I have a file containing timestamps (at micro-seconds granularity). It looks like the following: 06:49:42.383818 06:49:42.390190 06:49:42.392308 06:49:42.392712 06:49:42.393437 06:49:42.393960 06:49:42.402115 Now I need a sed/awk script to take the difference of two successive... (2 Replies)
Discussion started by: sajal.bhatia
2 Replies

10. Shell Programming and Scripting

script to compare first column of two files and find difference

Hi, I want to write a script which will compare the 1st column of both the files and will give the difference. e.g:- my 1st file contains: 89 /usr 52 /usr/local 36 /tmp 92 /opt 96 /home 27 /etc/opt/EMCom 1 ... (3 Replies)
Discussion started by: adityam
3 Replies
Login or Register to Ask a Question