![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using loop reading a file,retrieving data from data base. | Sonu4lov | Shell Programming and Scripting | 1 | 01-19-2007 03:38 AM |
| Subtract 2 months from the date | mahekr2000 | UNIX for Advanced & Expert Users | 5 | 07-23-2006 01:01 PM |
| Subtract Time | xadamz23 | Shell Programming and Scripting | 4 | 12-04-2005 02:18 AM |
| Subtract two dates in different lines | vanand420 | UNIX for Dummies Questions & Answers | 1 | 07-11-2005 02:40 AM |
| Subtract two date in unix | vanand | Shell Programming and Scripting | 1 | 06-18-2005 08:19 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I want to access of two different file.
cat in_file | awk -F: '{ in_total += $1 * 86400 + $2 * 3600 + $3 * 60 + $4 } END {printf "%d\n",in_total} ' cat out_file | awk -F: '{ out_total += $1 * 86400 + $2 * 3600 + $3 * 60 + $4 } END {printf "%d\n",out_total} ' I want to sub out_total from in_total |
|
||||
|
Code:
awk -F: ' FILENAME == "in_file" {
in_total += $1 * 86400 + $2 * 3600 + $3 * 60 + $4
}
FILENAME == "out_file" {
out_total += $1 * 86400 + $2 * 3600 + $3 * 60 + $4
}
END {printf "%d\n",in_total - out_total } ' in_file out_file
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|