Help require for vLookup Utility same as in EXCEL


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help require for vLookup Utility same as in EXCEL
# 22  
Old 01-08-2013
Sorry Robin, i think i gave you incorrect examples...please find attached the corrected files...File4.txt to be looked up in File5.txt and the output should be like File6_Output.txt...

Thanks.
# 23  
Old 01-08-2013
Hi Rudi....the code is working file in some cases...however please refer the attached...in few cases the value is not getting looked up...

Code:
Column 2 in File1.txt 

is looked up with Column 4 File2.txt

and the value of Column 4 is extracted in the output File3_Output.txt

However refer below mentioned line number are not being looked up for values

30492, 56681, 56686, 56704, 56705, 56706, 56707, 56712, 56713, 56714, 56718, 56756, 56761 and 64745..

Can you please chk and provide update...

Thanks

# 24  
Old 01-10-2013
Your file seems to contain non-unix-like (windows?) chars, like <CR> (0x0D, <carriage return>, ^M), 0xAE, and &amp; - pls get the coding right. No surprise if certain fields don't match should different codings be used.
On top, you want to use <TAB> as the separator, but on quite some lines, two <TAB>s are used to separate apparently like fields.
Not sure I get your new requirement - which fields from which file should go to the output file? If you match field $2 with field $4, and then extract $4, why don't you stay with $2 in the first place?
In your output file, you seem to add the product name again to the end of the line, which makes it occur three times:
Code:
WH553-1 Whitehall John Deere Round Welcome One Line Standard Wall Plaque        n/a     2419JY  Light Industrial        Home Maintenance        Mailboxes        Whitehall John Deere Round Welcome One Line Standard Wall Plaque        Whitehall John Deere Round Welcome One Line Standard Wall Plaque

Please advise.

Last edited by RudiC; 01-10-2013 at 02:17 PM.. Reason: typo
# 25  
Old 02-04-2013
Hi Rudi,

Sorry for the late reply...i was stuck with something else...

the file you are looking at is for sample....we usually use vlookup to reconcile the data and find the differences....that's y u can see i am trying to lookup product name with a product name.....additionally Column 8 is being looked up manually in an excel file to verify whether the output that is getting generated with our code is in accordance with what we want...

yeah , you are write the file might contain some hidden control characters or windows character...can you please help me how to remove those and the run the lookup code to get the desired result...


thanks in advance for all ur help...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

Vlookup in Linux

Hello Everybody I am looking for vlookup like functionality in Linux since two files I have are very big(1000MB each) and its not opening completely in excel. Here the requirement file1 11,12,13 16,14,12 28,21,22 22,23,24 file 3 18,16,16 14,12,12 23,22,24 16,11,13 here... (8 Replies)
Discussion started by: shanul karim
8 Replies

3. 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

4. Shell Programming and Scripting

Vlookup using awk

Hi folks, awk 'NR==FNR {m=$0; next} $1 in m{$0=m} {print}' file2 file1 Works a charm for a vlookup type query, sourced from https://www.unix.com/shell-programming-and-scripting/215998-vlookup-using-awk.html However my column content has white spaces and numbers. Example file1 The Man... (6 Replies)
Discussion started by: pshields1984
6 Replies

5. Shell Programming and Scripting

Perl script to Merge contents of 2 different excel files in a single excel file

All, I have an excel sheet Excel1.xls that has some entries. I have one more excel sheet Excel2.xls that has entries only in those cells which are blank in Excel1.xls These may be in different workbooks. They are totally independent made by 2 different users. I have placed them in a... (1 Reply)
Discussion started by: Anamika08
1 Replies

6. Shell Programming and Scripting

Vlookup using awk

Hello, I am trying to use vlookup (Excel function) using awk but there is some problem :( --file1-- ABC123 101F X1 A $P=Z X2 A $P=X X3 B $P=F X4 C $P=G MNK180 END --file2-- X1 A_t $P=Z X2 A_t $P=X X3 B_u $P=F X4 C_o $P=G (2 Replies)
Discussion started by: young
2 Replies

7. Shell Programming and Scripting

How to Unzip a file using unzip utility for files zipped without zip utility ?

Hi, I need to zip/compress a data file and send to a vendor. The vendor does have only unzip utility and can accept only .ZIP files. I do not have zip utility in my server. How do I zip/compress the file so that it can be deflated using unzip command ? I tried gzip & compress commands, but... (1 Reply)
Discussion started by: Sabari Nath S
1 Replies

8. Shell Programming and Scripting

PERL: Split Excel Workbook to Indiv Excel files

Hi, I am trying to find a way to read an excel work book with multiple worksheets. And write each worksheet into a new excel file using perl. My environment is Unix. For example: I have an excel workbook TEST.xls and it has Sheet1, Sheet2, Sheet3 worksheets. I would like to create... (2 Replies)
Discussion started by: sandeep78
2 Replies

9. Shell Programming and Scripting

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: 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

10. 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
Login or Register to Ask a Question