Sponsored Content
Top Forums Shell Programming and Scripting Compare two files A & B and accordingly modify file A Post 302415242 by appu2176 on Thursday 22nd of April 2010 05:13:23 AM
Old 04-22-2010
Compare two files A & B and accordingly modify file A

Friends,

i have two huge complex files (for eg :A & B)as output ,

the sample contents of the files are as follows :
A
==
Code:
ID,DATE,SUM1,SUM2,TOTAL(SUM1+2) 
A5066,20/04/2010,25000,50000,75000
A5049,20/04/2010,25000,60000,85000

B
==
Code:
ID,DATE,SUM1,SUM2,TOTAL(SUM1+2)
A5066,21/04/2010,25000,70000,95000
A5049,21/04/2010,25000,20000,45000

The above files are generated on daily basis and the problem is the printed date is calendar date.

I would like to compare the files A&B and print file C as follows :

File C :

Code:
ID,DATE,SUM1,SUM2,TOTAL(SUM1+2)
A5066,21/04/2010,25000,70000,95000
A5049,20/04/2010,25000,20000,45000

The condition is :
The date in the new file should be printed from the file (A) if the total(Column 5) in File B is less than File A

To be honest,i am confused of what command to use...I was nibbling with awk ..but couldn't go anywhere.It will be great if any suggestions or ideas can be provided.

Thanks in advance.

Last edited by vgersh99; 04-22-2010 at 06:39 AM.. Reason: code tags, please!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to search & compare paragraphs between two files

Hello Guys, Greetings to All. I am stuck in my work here today while trying to comapre paragraphs between two files, I need your help on urgent basis, without your inputs I can not proceed. Kindly find some time to answer my question, I'll be grateful to you for ever. My detailed issue is as... (10 Replies)
Discussion started by: NARESH1302
10 Replies

2. Shell Programming and Scripting

compare & split files

Hi All, I've 1 big file like: cat nid_lec_rej_20090804_merged 10084MOCLEC 0408090061480739nid090804132259.03.148990533 2526716790000008947850036448540401014 R030007150692000 2535502720000000010100036165742685000 R030007150354000 ... (12 Replies)
Discussion started by: ss_ss
12 Replies

3. Shell Programming and Scripting

How to compare 2 files & get only few columns based on a condition related to both files?

Hiiiii friends I have 2 files which contains huge data & few lines of it are as shown below File1: b.dat(which has 21 columns) SSR 1976 8 12 13 10 44.00 39.0700 70.7800 7.0 0 0.00 0 2.78 0.00 0.00 0 0.00 2.78 0 NULL ISC 1976 8 12 22 32 37.39 36.2942 70.7338... (6 Replies)
Discussion started by: reva
6 Replies

4. UNIX for Dummies Questions & Answers

How to compare 2 files & get specific value & replace it in other file.

Hiiii Friends I have 2 files with huge data. I want to compare this 2 files & if they hav same set of vales in specific rows & columns i need to get that value from one file & replace it in other. For example: I have few set data of both files here: a.dat: PDE-W 2009 12 16 5 29 11.11 ... (10 Replies)
Discussion started by: reva
10 Replies

5. Shell Programming and Scripting

How to Read & Compare Two Files

Hi forumers, How is it going. Ok i need some advice on the following problem. I have 2 files to read and compare data.FileA and FileB. FileA will return either status 1 or 0. FileB on the other hand is trickier and has the following details:- Count DeviceID CurrentStatus ... (7 Replies)
Discussion started by: prakash1111
7 Replies

6. Shell Programming and Scripting

Read data from .csv file through shell script & modify

I need to read data from a file called "test.csv" through shell script where the file contains values like name,price,descriptor etc. There are rows where descriptor (& in some rows name) are written as string & other characters like "car_+" OR "bike*" etc where it should contains strings like... (3 Replies)
Discussion started by: raj100
3 Replies

7. Shell Programming and Scripting

Format & Compare two huge CSV files

I have two csv files having 90K records each & each row has around 50 columns.Lets say the file names are FILE1 and FILE2. I have to compare both the files and generate a new file that has rows from FILE2 if it differs. FILE1 ----- 2001,"John",25,19901130,21211.41,Unix Forum... (3 Replies)
Discussion started by: Sheel
3 Replies

8. Shell Programming and Scripting

LINUX - How to compare the values in 2 files & exit from the script

Hi All, I have a requirement where I need to compare 2 files & if the values in the files match, it should proceed, else exit the script without proceeding further. For e.g : Scenario 1 In this case, the script should exit without proceeding further. Scenario 2 In this case, the script... (7 Replies)
Discussion started by: dsfreddie
7 Replies

9. Shell Programming and Scripting

Compare files & extract column awk

I have two tab delimited files as given below: File_1: PV16 E1 865 2814 1950 PV16 E2 2756 3853 1098 PV16 E4 3333 3620 288 PV16 E5 3850 4101 252 PV16 E6 83 559 477 PV16 E7 562 858 297 PV16 L2 4237 5658 ... (10 Replies)
Discussion started by: vaibhavvsk
10 Replies

10. Shell Programming and Scripting

How to Compare local & remote Files over ssh?

I want to make a script to compare list of files in terms of its size on local & remote server whose names are same & this is required over ssh. How can I accomplish this. Any help would be appreciated. (1 Reply)
Discussion started by: m_raheelahmed
1 Replies
FS_GETCACHEPARMS(1)					       AFS Command Reference					       FS_GETCACHEPARMS(1)

NAME
fs_getcacheparms - Displays the current size and usage of the cache SYNOPSIS
fs getcacheparms [-help] [-files] [-excessive] fs getca [-h] [-files] [-excessive] DESCRIPTION
The fs getcacheparms command displays the current size of the cache (which can be in memory or on disk), and the amount currently in use. The reported statistics are from kernel memory, so the reported size can differ from the setting specified in the /etc/openafs/cacheinfo file on a machine using a disk cache, if the fs setcachesize command has been used to alter cache size. OPTIONS
-help Prints the online help for this command. All other valid options are ignored. -files Displays the current number of cache files in use, and the maximum available, as well as displaying the current cache size. -excessive Displays detailed cache statistics, including the flags set on each cache element, and the distribution of cache entries by size. OUTPUT
The output reports AFS using <amount> of the cache's available <size> 1K byte blocks. where <amount> is the number of kilobyte blocks currently used to cache data and status information, and <size> is the total current cache size. EXAMPLES
The following example shows the output on a machine with a 25000 kilobyte cache. % fs getcacheparms AFS using 22876 of the cache's available 25000 1K byte blocks. The following shows the output when asked to show file information. % fs getcacheparm -files AFS using 0% of cache blocks (897 of 200000 1k blocks) 1% of the cache files (79 of 6250 files) And finally, the following detailed information can be obtained by using the excessive flag % fs getcacheparm -excessive AFS using 0% of cache blocks (897 of 200000 1k blocks) 1% of the cache files (79 of 6250 files) afs_cacheFiles: 6250 IFFree: 6171 IFEverUsed: 79 IFDataMod: 0 IFDirtyPages: 0 IFAnyPages: 0 IFDiscarded: 1 DCentries: 3122 0k- 4K: 74 4k- 16k: 3045 16k- 64k: 2 64k- 256k: 0 256k- 1M: 1 >=1M: 0 PRIVILEGE REQUIRED
None SEE ALSO
fs_setcachesize(1) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 FS_GETCACHEPARMS(1)
All times are GMT -4. The time now is 05:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy