I have two csv files file1 and file2. I want to compare both csv's by applying condition.
col2, col4 of file1 are equal to col2, col4 of file2 but difference in col6 of file1 and file2 eg: if col2 & col4 of file1 = col2 & col4 of file2 and col6 in file1 != col6 in file2 then get the output based on the condition.
I tried awk but it is not giving me the desired results. I searched a lot on internet and forums but I am out of searches now.
My awk code is
Quote:
Getting out put only for [$2$4]=$2$4 condition its not considering [$6] != $6 condtion.
There is something wrong in my script. Please help me
Please help me to resolve this issue. Also let me know if we can resolve this using Python
Hi all,
Am new to scripting. So i just need your ideas to help me out. Here goes my requirement.
I have two csv files
1.csv 2.csv
abc,1.24 abc,1
def,2.13 def,1
I need to compare the first column of 1.csv with 2.csv and if matches then need to compare... (2 Replies)
Hi
I have to compare two .csv files which having 4 columns and i am expecting the output if there is difference in the 3,4columns in two files with respect to the first column. if my statement is not clear please refer the example.
Input:
-----
File 1 :
hostname MAC SWITCH_IP SWITCH_PORT... (7 Replies)
Hi all,
Could someone help me with the following issue:
1st
I have an CSV file delimiter is ";" I I have a column 7 where I need to do some multiple mathem. operation, I need all values in this columns to be multiplied by 1.5 and create a new CSV file with the replaced values.
2nd.
I... (3 Replies)
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)
Hi,
I have a file of csv data, which looks like this:
file1:
1AA,LGV_PONCEY_LES_ATHEE,1,\N,1,00020460E1,0,\N,\N,\N,\N,2,00.22335321,0.00466628
2BB,LES_POUGES_ASF,\N,200,200,00006298G1,0,\N,\N,\N,\N,1,00.30887539,0.00050312... (10 Replies)
Hi, I am newbie in shell script.
I need your help to solve my problem.
Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file.
File1:
SourceFile,DateTimeOriginal
/home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07... (8 Replies)
I have 8 .csv files with 16 columns and "n" rows with no Header. I want to parse each of these .csv and get column and put the data into a new.csv. Once this is done, the new.csv should have 16 columns (2 from each input.csv) and "n" rows.
Now, I want to just take the average of Column from... (3 Replies)
Hello,
I want to compare two csv files expected.csv and actual.csv by fields "f3", "f4", "f5". Field "z" can be differnt.
Each record identified by two fields: "number" +"key".
Records are not sorted.
Can you please help me to get such report:
Error: Mismatch in the record... (4 Replies)
Discussion started by: Eugenne
4 Replies
LEARN ABOUT OSF1
sdiff
sdiff(1) General Commands Manual sdiff(1)NAME
sdiff - Compares two files and displays the differences in a side-by-side format
SYNOPSIS
sdiff [-l | -s] [-w number] [-o output_file] file1 file2
The sdiff command reads file1 and file2, uses diff to compare them, and writes the results to standard output in a side-by-side format.
OPTIONS
Displays only the left side when lines are identical. Creates a third file, output_file, by a controlled interactive line-by-line merging
of file1 and file2. The following subcommands govern the creation of this file: Adds the left side to output_file. Adds the right side to
output_file. Stops displaying identical lines. Begins displaying identical lines. Enters ed with the left side, the right side, both
sides, or an empty file, respectively.
Each time you exit from ed, sdiff writes the resulting edited file to the end of output_file. If you fail to save the changes
before exiting, sdiff writes the initial input to output_file. Exits the interactive session. Suppresses display of identical
lines. Sets the width of the output line to number (130 characters by default).
DESCRIPTION
The sdiff command displays each line of the two files with a series of spaces between them if the lines are identical, a < (left angle
bracket) in the field of spaces if the line only exists in file1, a > (right angle bracket) if the line only exists in file2, and a | (ver-
tical bar) for lines that are different.
When you specify the -o option, sdiff produces a third file by merging file1 and file2 according to your instructions.
Note that the sdiff command invokes the diff -b command to compare two input files. The -b option causes the diff command to ignore trail-
ing spaces, tab characters, and consider other strings of spaces as equal.
EXAMPLES
To print a comparison of two files, enter: sdiff chap1.bak chap1
This displays a side-by-side listing that compares each line of chap1.bak and chap1. To display only the lines that differ, enter:
sdiff -s-w 80 chap1.bak chap1
This displays the differences at the tty. The -w 80 sets page width to 80 columns. The -s option tells sdiff not to display lines
that are identical in both files. To selectively combine parts of two files, enter: sdiff -s-w 80 -o chap1.combo chap1.bak
chap1
This combines chap1.bak and chap1 into a new file called chap1.combo. For each group of differing lines, sdiff asks you which group
to keep or whether you want to edit them using ed.
SEE ALSO
Commands: diff(1), ed(1)sdiff(1)