## calculate from three files

calculate from three files
# 1
01-08-2008
calculate from three files

Hi all
I have 3 three files like:
file1:

1|100
2|200
3|300
4|400
5|500

file2:
1|200
2|200
3|600
4|800

file3:
1|300
2|100
3|200

i would like out put file like:
1|100|200|300|0
2|200|200|100|100
3|300|600|200|700
4|400|800|0|1200

senario:

i wolud like

file1.column2+file2.cloumn2-file3.cloumn2

 koti_rama View Public Profile for koti_rama Find all posts by koti_rama
# 2
01-08-2008
what have you tried?
 ghostdog74 View Public Profile for ghostdog74 Find all posts by ghostdog74
# 3
01-08-2008
Output:

Quote:
1|100|200|300|0
2|200|200|100|300
3|300|600|200|700
4|400|800|0|1200
5|500|0|0|500
 dennis.jacob View Public Profile for dennis.jacob Find all posts by dennis.jacob
# 4
01-08-2008
thanks......
 koti_rama View Public Profile for koti_rama Find all posts by koti_rama
# 5
01-08-2008
\$ paste -d "|" filex filey filez | awk '
> BEGIN{OFS=FS="|"} {print \$1,\$2,\$4,\$6,\$2+\$4-\$6}
> ' | awk 'BEGIN{OFS=FS="|"}{ for(i=0;i<=NF;i++)
> if ( \$i == "" )
> \$i=0
> print \$0}'

<Output>
1|100|200|300|0
2|200|200|100|300
3|300|600|200|700
4|400|800|0|1200
5|500|0|0|500
# 6
01-08-2008
Another one:

## Calculate percent using values in 2 files

Trying to use file1 which is the actual counts in \$2 associated with each \$1 entry. The total of each \$1 is in file2 with the total in \$3. So when there is a match between \$1 in file1 with \$1 in file2, then the % is calculated using the \$2 value of file1 and \$3 value of file2. Thank you :). ...

## Du -sh command taking time to calculate the big size files

Hi , My linux server is taking more time to calculate big size from long time. * i am accessing server through ssh * commands # - du -sh * #du -sh * | sort -n | grep G Please guide me for fast way to find big size directories under to / partition Thanks

## How to calculate mode for several files HELPPPP!!

Hello my problem is that: I have several files with 4 columns and I want to calculate mode of 4th column for each file and write 2nd 3rd and mode value as an output file. Here is an example of my files: 2005-01-21 05:30:00 0.518736 -163 2005-01-20 05:30:00 0.518736 -160...

## perl - calculate the number of lines from particular files

Hi, plz see the below code. here my aim is to calculate the number of lines in unprocessedData.out if this file contains 40 lines then lastly \$linenum should print 40.(except blank lines) i have tried below code but it giving me the output only one. can anyone help me how to do ? ...

## Shell script to calculate the size of files

Dear all, Please help me to write a script that can calculate the size of files. For example: I have a directory which contain thousands of files. I need to know the size of files that their name begin with abc_123 Thank all!!

## Calculate age of a file | calculate time difference

Hello, I'm trying to create a shell script (#!/bin/sh) which should tell me the age of a file in minutes... I have a process, which delivers me all 15 minutes a new file and I want to have a monitoring script, which sends me an email, if the present file is older than 20 minutes. To do...

## Grep string from logs of last 1 hour on files of 2 different servers and calculate count

Hi, I am trying to grep a particular string from the files of 2 different servers without copying and calculate the total count of its occurence on both files. File structure is same on both servers and for reference as follows: 27-Aug-2010...

## How to calculate the entropy of a single directory that contains many files

Hello, I'm new member of shell scripting and i face some difficulties. To begin, i try to write an algorithm that calculate from one directory containing nfdump files (288) the entropy of one day 24hours. Each of the file is 5 min interval (nfdump -r nfcapd.200908250000 -s srcip) 1st (nfdump...

## Calculate Files Created Today

I need to figure out how to get all the files from a certian dir ./123/*sat files and ./230/*sat files and several other directories which have these *sat files in them. I need to calculate how many were created today and how many yesterday from 2:00 pm on the 28th to 2pm on the 29th. It's a...

## calculate size of some files

Hi, 1-I want to calculate the size of all files which are generated during last month in a directory. How can I do that ? Of cours, I find them by : \$ls -l | grep jun but how to calculate the sum of their size ? 2- the same but for all files generated last month and before that. many thanks...