10-17-2012
Help need to subtract the data from 2 columns
space_used.lst
|
/dev/vx/dsk/A06487-S01-c4e3s-ORACLE-dg/oradata01 505G 318G 175G 65% /dborafiles/nethealth21/PV/oradata01 |
/dev/vx/dsk/A06487-S01-c4e3s-ORACLE-dg/oradata02 505G 433G 67G 87% /dborafiles/nethealth21/PV/oradata02 |
/dev/vx/dsk/A06487-S01-c4e3s-ORACLE-dg/oradata03 507G 422G 79G 85% /dborafiles/nethealth21/PV/oradata03 |
/dev/vx/dsk/A06487-S01-c4e3s-ORACLE-dg/oradata04 507G 312G 182G 64% /dborafiles/nethealth21/PV/oradata04 |
/dev/vx/dsk/A06487-S01-c4e3s-ORACLE-dg/oradata05 507G 356G 141G 72% /dborafiles/nethealth21/PV/oradata05 |
/dev/vx/dsk/A06487-S01-c4e3s-ORACLE-dg/oradata06 507G 220G 269G 46% /dborafiles/nethealth21/PV/oradata06 |
/dev/vx/dsk/A06487-S01-c4e3s-ORACLE-dg/oradata07 101G 46G 52G 47% /dborafiles/nethealth21/PV/oradata07 |
/dev/vx/dsk/A06487-S01-c4e3s-ORACLE-dg/oradata08 450G 255G 183G 59% /dborafiles/nethealth21/PV/oradata08 |
/dev/vx/dsk/A06487-S01-c4e3s-ORACLE-dg/oradata09 456G 321G 126G 72% /dborafiles/nethealth21/PV/oradata09 |
/dev/vx/dsk/A06487-S01-c4e3s-ORACLE-dg/oradata10 300G 231G 65G 78% /dborafiles/nethealth21/PV/oradata10 |
Actual_used.lst
|
317G /dborafiles/nethealth21/PV/oradata01 |
433G /dborafiles/nethealth21/PV/oradata02 |
422G /dborafiles/nethealth21/PV/oradata03 |
312G /dborafiles/nethealth21/PV/oradata04 |
356G /dborafiles/nethealth21/PV/oradata05 |
220G /dborafiles/nethealth21/PV/oradata06 |
45G /dborafiles/nethealth21/PV/oradata07 |
254G /dborafiles/nethealth21/PV/oradata08 |
321G /dborafiles/nethealth21/PV/oradata09 |
230G /dborafiles/nethealth21/PV/oradata10 |
My requirement is to subtract values as below.
(column 3 displayed in space_used.lst) - (column 1 displayed in actual_used.lst)
And I expect the output as below. Can you pls help me to write a shell script?
|
Desired output: |
=============== |
1G /dborafiles/nethealth21/PV/oradata01 |
0G /dborafiles/nethealth21/PV/oradata02 |
0G /dborafiles/nethealth21/PV/oradata03 |
0G /dborafiles/nethealth21/PV/oradata04 |
0G /dborafiles/nethealth21/PV/oradata05 |
0G /dborafiles/nethealth21/PV/oradata06 |
0G /dborafiles/nethealth21/PV/oradata07 |
1G /dborafiles/nethealth21/PV/oradata08 |
0G /dborafiles/nethealth21/PV/oradata09 |
1G /dborafiles/nethealth21/PV/oradata10 |
|
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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... (2 Replies)
Discussion started by: krishna_sicsr
2 Replies
2. Shell Programming and Scripting
Hope somebody is happy.
NR==1 {
num_columns=split( $0, menuend );
next;
}
{
split( $0, substrend );
for ( i=1; i<=NF; i++ ) {
minuend -= substrend;
}
}
END {
print "Result:";
for ( i=1; i<=num_columns; i++ ) {
printf(... (3 Replies)
Discussion started by: awkward
3 Replies
3. Shell Programming and Scripting
Hi,
I need some help figuring this out, I think it can be done using awk but I don't know how.
So, I want to take two input files, subtract some columns with each other and then output to a new results file.
InFile1.txt
AAA 100 200 BBB
CCC 300 400 DDD
InFile2.txt
AAA 50 60 BBB
CCC 70... (7 Replies)
Discussion started by: MrTrigger
7 Replies
4. Shell Programming and Scripting
Hi,
I want to subtract a number from all columns except the first column. I have a number of files each having different columns around 60/70. How to do that in awk or any other command?
Thanks
Input
Col 1 Col 2 Col3 - - - - Col55
1 .0123 .098 - - - 0.6728
2 - -... (3 Replies)
Discussion started by: Surabhi_so_mh
3 Replies
5. Shell Programming and Scripting
Hi,
I have one .csv file. I have 2 date columns present in file, column 2 and column 3.
I need to calculate how many days exist between 2 dates.
I am trying to subtract date column 2 from date column 3.
Eg: my file look likes
s.no, Start_date,End_Date
1, 7/29/2012,10/27/2012
2,... (9 Replies)
Discussion started by: Dimple
9 Replies
6. Shell Programming and Scripting
Hi All,
I have a file with thousands of lines in the following format, where
Field1=First 8 characters
Field2-9-16 characters
Field3=17-26 characters
I need to add Field 1 and Field2 and subtract the result from Field 3.
Field3=Field3 - (Field1 + Field2)
0012.00 0010.00 0001576.53... (4 Replies)
Discussion started by: nua7
4 Replies
7. Shell Programming and Scripting
I have a file which has all integer numbers like this. This file is sort of very large, and I am only showing the first few contents. This representation can be regarded as a matrix of integer numbers.
14998
16 0 11680 3165 15343 8553 9925 3875 820 6430 14226 13261 11355 15428 9140 16184 7934... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies
8. UNIX for Dummies Questions & Answers
---------- Post updated at 01:58 PM ---------- Previous update was at 01:48 PM ----------
For some reason my question is not getting printed. Here are the details:
Greetings.
I would like to add/subtact an integer to/from two columns of integers. I feel like this should be easy using awk... (3 Replies)
Discussion started by: Twinklefingers
3 Replies
9. Shell Programming and Scripting
Hi below is a file
Date Category Time Attempts Success
2/17/2014 PayFlow ATB 0.999988 4039104 4039057
2/18/2014 PayFlow ATB 0.999912 4620964 4620558
2/19/2014 PayFlow ATB 0.999991 4380836 4380796
2/20/2014 PayFlow ATB 0.999988 5031047 5030985
2/21/2014 ... (5 Replies)
Discussion started by: villain41
5 Replies
10. Shell Programming and Scripting
Hi,
I have 2 files in below formats
File1_Stored.txt
ABC:100, 83
ABC:84, 53
ABC:14, 1222And
File2_Stored.txt
ABC:100 , 83
ABC:84 , 1553
ABC:524 , 2626I am trying to get the 3rd file in below format. So, whenever difference is 0 it shouldn't appear but if the difference is not 0 then... (2 Replies)
Discussion started by: Abhayman
2 Replies
LEARN ABOUT OSX
mkdevmaps
mkdevmaps(1M) System Administration Commands mkdevmaps(1M)
NAME
mkdevmaps - make device_maps entries
SYNOPSIS
/usr/sbin/mkdevmaps
DESCRIPTION
The mkdevmaps command writes to standard out a set of device_maps(4) entries describing the system's frame buffer, audio, and removable
media devices.
The mkdevmaps command is used by the init.d(4) scripts to create or update the /etc/security/device_maps file.
Entries are generated based on the device special files found in /dev. For the different categories of devices, the mkdevmaps command
checks for the following files under /dev:
audio /dev/audio, /dev/audioctl, /dev/sound/...
tape /dev/rst*, /dev/nrst*, /dev/rmt/...
floppy /dev/diskette, /dev/fd*, /dev/rdiskette, /dev/rfd*
removable disk /dev/dsk/c0t?d0s?, /dev/rdsk/c0t?d0s?
frame buffer /dev/fb
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|Interface Stability |Obsolete |
+-----------------------------+-----------------------------+
SEE ALSO
allocate(1), bsmconv(1M), attributes(5)
NOTES
mkdevmaps might not be supported in a future release of the Solaris operating system.
SunOS 5.10 8 Oct 2003 mkdevmaps(1M)