11-27-2019
How to compare two files in UNIX using similar to vlookup?
Hi,
I want to compare same column in two files, if values match then display the column or display "NA".
Ex :
File 1 :
123
abc
xyz
pqr
File 2:
122
aab
fdf
pqr
fff
qqq
rrr
xyz
sst
Compare column:
2
NA
y
NA
NA
NA
can someone help me with logic for this.
thanks,
BBBB
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I would like to know how to compare a listing of directories that begin with the same four numbers ie.
/1234cat
/1234tree
/1234fish
and move all these directories into one directory
Thanks in advance (2 Replies)
Discussion started by: tgibson2
2 Replies
2. Shell Programming and Scripting
Kindly help me to build the script similar to VLOOKUP function of MS Excell. (5 Replies)
Discussion started by: hjoshi
5 Replies
3. Shell Programming and Scripting
Dear All,
i want to implement vookup function which is there in excel into Unix. Suppose i have 2 files. The files are given below.
File1:
MSC Cell SDCA
Patna-1 12 Bihar
Patna-2 45 Ranchi
Bhopal-1 85 Raigarh
Bhopal-2 ... (8 Replies)
Discussion started by: pravani1
8 Replies
4. Shell Programming and Scripting
I got many pair files, which only have small difference, such as more space, or more empty line, and some unreadable characters.
If list by commend "diff", I can see many many difference.
So I'd like to write a script to compare the pair files, if 95% contents are same, I will think they are... (2 Replies)
Discussion started by: rdcwayx
2 Replies
5. Shell Programming and Scripting
I would like to merge data from a reference file and a data file to produce a new output file as shown below.
Reference file,data file,output file
a , b 2 , a 0
b , d 4 , b 2
c , , c 0
d , , d 4
e, , e 0 (3 Replies)
Discussion started by: godzilla07
3 Replies
6. Shell Programming and Scripting
hi frnds
i have 2 files. 1st is dddd and 2nd is ssss
==> dddd <==:
1,charit
2,gilhotra
==> ssss <==:
1,sajan
2,doda
3,hello
and i want o/p ...mean join and vlookup both files
sajan,charit (4 Replies)
Discussion started by: dodasajan
4 Replies
7. Shell Programming and Scripting
Hi,
I am new to awk/unix and am trying to put together an awk script to perform an action similar to vlookup between the two csv files.
Here are the contents of the two files:
File 1:
Date,ParentID,Number,Area,Volume,Dimensions
2014-01-01,ABC,247,83430.33,857.84,8110.76... (9 Replies)
Discussion started by: Prit Siv
9 Replies
8. Shell Programming and Scripting
I have 2 files namely branch.txt file & RXD.txt file as below
Ex:Branch.txt
=========================
B1,Branchname1,city,country
B2,Branchname2,city,country
B3,Branchname3,city,country
B4,Branchname4,city,country
B5,Branchname5,city,country
RXD file : will... (11 Replies)
Discussion started by: satece
11 Replies
9. Shell Programming and Scripting
I need to vlookup and check the server not found.
Source file 1
server1
server2
server3
server4
server5_root
server6_silver
server7
server7-test
server7-temp
Source file 2
server1_bronze (6 Replies)
Discussion started by: ranjancom2000
6 Replies
10. UNIX for Beginners Questions & Answers
Hello, i am trying to print group name column(etc/group) on script (etc/passwd) since group name is not listed on etc/passwd columns. Im trying to do a vlookup. but i cant figure out how i can insert the vlookup command FNR==NR inside the print out command or the output. I also tried exporting... (2 Replies)
Discussion started by: joonisio
2 Replies
sdiff(1) General Commands Manual sdiff(1)
NAME
sdiff - side-by-side difference program
SYNOPSIS
[options ...] file1 file2
DESCRIPTION
uses the output of diff(1) with the option, which ignores trailing blanks (spaces and tabs) and treats other strings of blanks as equal, to
produce a side-by-side listing of two files, indicating those lines that are different. Each line of the two files is printed with a blank
gutter between them if the lines are identical, a in the gutter if the line only exists in file1, a in the gutter if the line only exists
in file2, and a for lines that are different.
For example:
abc | xyz
abc abc
bca <
cba <
dcb dcb
> cde
Options
recognizes the following options:
Use the next argument,
n, as the width of the output line. The maximum value of n is 2048 (LINE_MAX). The default line length is 130 charac-
ters.
Only print on the left side when lines are identical.
Do not print identical lines.
Use the next argument,
output, as the name of a third file that is created as a user-controlled merging of file1 and file2. Identical lines of
file1 and file2 are copied to output. Sets of differences, as produced by diff(1), are printed; where a set of differ-
ences share a common gutter character. After printing each set of differences, prompts the user with a and waits for
one of the following user-typed commands:
append the left column to the output file
append the right column to the output file
turn on silent mode; do not print identical lines
turn off silent mode
call the editor with the left column
call the editor with the right column
call the editor with the concatenation of left and right
call the editor with a zero length file
exit from the program
On exit from the editor, the resulting file is concatenated on the end of the output file.
EXAMPLES
Print a side-by-side diff of two versions of a file on a printer capable of printing 132 columns:
Retrieve the most recently checked in version of a file from RCS and compare it with the version currently checked out:
SEE ALSO
diff(1), ed(1).
sdiff(1)