Sponsored Content
Top Forums Shell Programming and Scripting Compare two files and merge columns in a third Post 302113252 by Shell_Life on Wednesday 4th of April 2007 11:39:29 AM
Old 04-04-2007
Here is one possible solution for your original post using only unix commands:

### Create matched records: in update file and also in the master file.
egrep -f upd_file master_file > matched_file

### Create not matched records: in update file and not in matched file.
egrep -v -f matched_file upd_file > tmp_not_matched_file

### Add "NOT FOUND" to the end of not matched records.
sed 's/$/NOT FOUND/' tmp_not_matched_file > not_matched_file

### Merge and sort all records into solution file.
sort matched_file not_matched_file > solution_file

Last edited by Shell_Life; 04-04-2007 at 12:49 PM.. Reason: correct mistyped word.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

compare the column from 3 files and merge that line

I have 3 file, each of has got 80000 records. file1.txt ----------------------- ABC001;active;modify;accept; ABC002;notactive;modify;accept; ABC003;notactive;no-modify;accept; ABC004;active;modify;accept; ABC005;active;no-modify;accept; file2.txt ---------------------------... (8 Replies)
Discussion started by: ganesh_mak
8 Replies

2. UNIX for Dummies Questions & Answers

compare columns from 2 files and merge

Dear all, Being new to Unix i have a problem. I have 2 files: File 1: 118,1,0,2,3,0,5,0.3,0,0.3,0.6,1 118,2,1,2,2,0,5,0.4,0,0.4,0.4,1 118,4,2,0,3,0,5,0.7,0,0.3,0.6,1 118,6,4,1,0,0,5,0.8,0,0.2,0,1 File 2: 118,1,BFGL-NGS-109695,3610326,0,18,1,0.556,0.389,0.056,0.25,0.8183... (2 Replies)
Discussion started by: samwilkinson
2 Replies

3. Shell Programming and Scripting

merge the two files which has contain columns

Hi may i ask how to accomplish this task: I have 2 files which has multiple columns first file 1 a 2 b 3 c 4 d second file 14 a 9 .... 13 b 10.... 12 c 11... 11 d 12... I want to merge the second file to first file that will looks like this ... (2 Replies)
Discussion started by: jao_madn
2 Replies

4. UNIX for Dummies Questions & Answers

Merge two files with two columns being similar

Hi everyone. How can I merge two files, where each file has 2 columns and the first columns in both files are similar? I want all in a file of 4 columns; join command removes the duplicate columns. 1 Dave 2 Mark 3 Paul 1 Apple 2 Orange 3 Grapes to get it like this in the 3rd file:... (9 Replies)
Discussion started by: Atrisa
9 Replies

5. Shell Programming and Scripting

Merge columns of different files

Hi, I have tab limited file 1 and tab limited file 2 The output should contain common first column vales and corresponding 2nd column values; AND also unique first column value with corresponding 2nd column value of the file that contains it and 0 for the second file. the output should... (10 Replies)
Discussion started by: polsum
10 Replies

6. Shell Programming and Scripting

Compare and Merge files

Hi All, I have two different files as shown below separated by a "|". I need to compare the first column from both the files and if they match merge both the columns. File 1 "S00172012"|"CHRONIC RENAL FAILURE"|""|"I" "S00159962"|"SUBENDO INFRC-INIT EPISD"|""|"I" "S00255303"|"BENIGN... (6 Replies)
Discussion started by: nua7
6 Replies

7. Shell Programming and Scripting

Merge columns on different files

Hello, I have two files that have this format: file 1 86.82 0.00 86.82 43.61 86.84 0.00 86.84 43.61 86.86 0.00 86.86 43.61 86.88 0.00 86.88 43.61 file 2 86.82 0.22 86.84 0.22 86.86 0.22 86.88 0.22 I would like to merge these two files such that the final file looks like... (5 Replies)
Discussion started by: kayak
5 Replies

8. Shell Programming and Scripting

Compare two files and merge into third

Hello: Newbie with Awk. Trying to compare two files and merge data based on CID. Please see the input file format and desired output. Any help is appreciated. TIA Input File1 CID1 --- TYP1 --- DCN1 --- INDATE1 --- IN-DATA1 CID2 --- TYP2 --- DCN2 --- INDATE2 --- IN-DATA2 CID3 ---... (6 Replies)
Discussion started by: wincrazy
6 Replies

9. Shell Programming and Scripting

Compare 2 csv files by columns, then extract certain columns of matcing rows

Hi all, I'm pretty much a newbie to UNIX. I would appreciate any help with UNIX coding on comparing two large csv files (greater than 10 GB in size), and output a file with matching columns. I want to compare file1 and file2 by 'id' and 'chain' columns, then extract exact matching rows'... (5 Replies)
Discussion started by: bkane3
5 Replies

10. Shell Programming and Scripting

Compare and merge two big CSV files

Hi all, i need help. I have two csv files with a huge amount of data. I need the first column of the first file, to be compared with the data of the second, to have at the end a file with the data not present in the second file. Example File1: (only one column) profile_id 57036226... (11 Replies)
Discussion started by: SirMannu
11 Replies
snmp-ups(8)						      Network UPS Tools (NUT)						       snmp-ups(8)

NAME
snmp-ups - Driver for RFC 1628 SNMP UPS equipment NOTE
This man page only documents the hardware-specific features of the snmp-ups driver. For information about the core driver, see nutups- drv(8). SUPPORTED HARDWARE
Any UPS that is RFC 1628 (UPS MIB) compliant. EXPERIMENTAL DRIVER
This driver has been tagged experimental and is not built by default. REQUIREMENTS
This driver needs UCD SNMP, aka Net-SNMP installed to compile successfully. See http://www.net-snmp.org/ for more information. On Red Hat 7.2, these packages are required: ucd-snmp-devel-4.2.3-1, ucd-snmp-4.2.3-1, ucd-snmp-utils-4.2.3-1 You must install SNMP-UPS-MIB.txt in your MIBs directory - typically /usr/share/snmp/mibs/, but it may vary from system to system. You can generate this from chapter 4 of RFC 1628 (see http://www.faqs.org). EXTRA ARGUMENTS
This driver supports the following optional settings in the ups.conf(5): community=name Set community name (default = public) snmp_version=version Set SNMP version (default = v1, the other allowed value is v2c) INSTALLATION
This driver is not built by default. You can build it by using "configure --with-drivers=snmp-ups" before calling make. IMPLEMENTATION
The hostname of the UPS is specified with the "port" value in ups.conf, i.e.: [snmp] driver = snmp-ups port = snmp-ups.example.com community = public snmp_version = v1 SUPPORTED VARIABLES
INFO_MFR UPS Manufacturer INFO_MODEL UPS Model INFO_FIRMREV Firmware/Software Version INFO_STATUS OFF, OL, OB, BOOST, TRIM INFO_BATTPCT Battery percentage INFO_RUNTIME Predicted runtime on battery INFO_BATTVOLT Battery Voltage INFO_OUTVOLT Output Voltage PLANNED SUPPORT
INFO_UTILITY Input Voltage INFO_ACFREQ AC Frequency INFO_UPSTEM UPS Temperature INFO_LOADPCT Load Percentage CMD_? Not determined AUTHORS
Arnaud Quette, Hans Ekkehard Plesser SEE ALSO
The core driver: nutupsdrv(8) Internet resources: The NUT (Network UPS Tools) home page: http://www.exploits.org/nut/ NUT mailing list archives and information: http://lists.exploits.org/ Tue Oct 22 2002 snmp-ups(8)
All times are GMT -4. The time now is 01:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy