Sponsored Content
Top Forums Shell Programming and Scripting Want to implement VLOOKUP (Excel function) in Unix Post 302194881 by pravani1 on Wednesday 14th of May 2008 12:14:41 AM
Old 05-14-2008
MySQL Want to implement VLOOKUP (Excel function) in Unix

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:
Code:
MSC	             Cell	SDCA
Patna-1	             12	Bihar
Patna-2	             45	Ranchi
Bhopal-1	             85	Raigarh
Bhopal-2	             66	Indore
Mumbai-1	78	Turbhe
Mumbai-2	25	Nashik
Mumbai-3	45	Dhule

& File2:
Code:
MSC		New MSC
Patna-1		Patna1
Patna-2		Patnaomp2
Bhopal-1	             bhopal
Bhopal-2	             bhopal2
Mumbai-1	mum1
Mumbai-2	mumomp2
Mumbai-3	mum3

The required output must like this:
Code:
result
MSC		Cell	SDCA
Patna1		12	Bihar
Patnaomp2	45	Ranchi
bhopal		85	Raigarh
bhopal2		66	Indore
mum1		78	Turbhe
mumomp2	25	Nashik
mum3		45	Dhule

Please help me for the same.

Thank u

Last edited by Yogesh Sawant; 05-14-2008 at 02:18 AM.. Reason: added code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

VLOOKUP utility in UNIX

Kindly help me to build the script similar to VLOOKUP function of MS Excell. (5 Replies)
Discussion started by: hjoshi
5 Replies

2. Programming

How to implement polling for a function using timer in C?

Hi, Can you please help me in implementing a timer based polling for function in C? ie. the function should be called in say 30secs(when 30secs has lapsed). Thanks (7 Replies)
Discussion started by: naan
7 Replies

3. Shell Programming and Scripting

Help require for vLookup Utility same as in EXCEL

Hi guys, can someone please help me with a vlookup utility in shell script that does the work similar to Excel. Ex: If File1.txt is 1 2 11 4 12 and File2.txt is 1 tab1 2 tab2 3 tab3 4 tab4 5 tab5 then the utility should create File3.txt with the below mentioned output: (24 Replies)
Discussion started by: viveklgupta007
24 Replies

4. UNIX for Dummies Questions & Answers

Implement the '&&' function in a shell

Hello, I'm currently implementing the && function in a shell using C. For example, if we input cmd1 && cmd2, then cmd2 executes only when cmd1 exits successfully. I'm thinking about: int main() { int i; char **args; while(1) { printf("yongfeng's shell:~$ "); args =... (5 Replies)
Discussion started by: Yongfeng
5 Replies

5. Shell Programming and Scripting

awk script to perform an action similar to vlookup between two csv files in UNIX

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

6. UNIX for Dummies Questions & Answers

Command for vlookup function

Hello experts, I have large text files that need to be arranged using a function like excel's vlookup. I have been playing with awk command but didn't really come up with a solution. Could anyone please help me out? Below are my datasets and expected output. Any help would be greatly... (8 Replies)
Discussion started by: makelifeeasier
8 Replies

7. Shell Programming and Scripting

Trying to implement count_collatz_step function

Can anyone give me a clue why this code doesn't work as expected? The function count_collatz_step() take one parameter which a number that need to calculate collatz until it reaches 1. The func should return steps it takes. # # Count steps of collatz conjecture takes, until the number reach 1.... (8 Replies)
Discussion started by: Bunchhieng
8 Replies

8. Shell Programming and Scripting

Excel vlookup function like value mapping with awk

I have two files File1 175552 st_497858.1 rs86052.1 rs92185.1 st_001022416.1 174841 175552_174841 179912 st_001122967.2 rs90435.1 rs89122.1 st_001022583.1 175545 179912_175545 179912 st_001122967.2 rs90435.1 rs89122.1 st_001022584.1 175545 179912_175545 179967 st_001256606.1 rs93516.2... (1 Reply)
Discussion started by: sammy777888
1 Replies

9. UNIX for Beginners Questions & Answers

Vlookup on 2 files - inserting vlookup command on another command

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

10. UNIX for Beginners Questions & Answers

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 (1 Reply)
Discussion started by: hkoshekay
1 Replies
MACUTIL(1)						      General Commands Manual							MACUTIL(1)

NAME
macutil - A package that deals with MacIntosh files on a Unix system DESCRIPTION
macutil is a package that contains a number of utilities that deal with MacIntosh files on a Unix system. It contains the following pro- grams: binhex Convert files to BinHex 4.0 compatible hexified form. frommac Receives files from the MacIntosh on the Unix system. hexbin Convert hexified files to their MacIntosh format. macsave Save a series of files from a MacBinary stream as individual files. macstream Combine a series of files to a MacBinary stream. macunpack Unpack a MacIntosh archive into its constituents. tomac Transmits files from the Unix system to a MacIntosh. BUGS
This manual page is hopelessly incomplete! SEE ALSO
binhex(1), frommac(1), hexbin(1), macsave(1), macstream(1), macunpack(1), tomac(1) AUTHOR
Dik T. Winter, CWI, Amsterdam, The Netherlands (dik@cwi.nl) 3rd Berkeley Distribution October 22, 1992 MACUTIL(1)
All times are GMT -4. The time now is 07:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy