Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Vlookup on 2 files - inserting vlookup command on another command Post 303035724 by Scrutinizer on Saturday 1st of June 2019 02:42:30 AM
Old 06-01-2019
Do you mean something like this?

Code:
awk -F: '
  NR==FNR {
    A[$3]=$1
    next
  }

  $4 in A {
    $4=A[$4]
  }

  {
    printf "%-20s %-10s %-30s\n", $1,$4,$7 
  }
' /etc/group /etc/passwd

These 2 Users Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

merge files like VLOOKUP

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

2. Shell Programming and Scripting

vlookup files

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

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

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

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

6. Shell Programming and Scripting

Vlookup using awk non similar files

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

7. Shell Programming and Scripting

Vlookup using Ask from specific column from two files

File1 alias:server1_00,20:f1:0a:25:b5:03:02:90 alias:server2_00,20:f1:0a:25:b5:03:02:91 alias:server3_00,50:00:09:75:50:0d:bd:da alias:server4_00,20:f1:0a:25:b5:03:02:93 alias:server5_00,21:00:00:24:ff:8b:e1:fe alias:server6_00,50:00:09:75:50:08:54:44... (17 Replies)
Discussion started by: ranjancom2000
17 Replies

8. Shell Programming and Scripting

Conditional Vlookup

Hi everyone, I need to replace values of column 2 array1 with values of column 2 array2 based on a lookup of column 4 value, but only return a value IF the values in column 1 of BOTH array1 and array2 match, otherwise keep original value in column 2 of array1. Both files are tab delimited... (2 Replies)
Discussion started by: Geneanalyst
2 Replies

9. UNIX for Beginners Questions & Answers

Vlookup not using awk

Hi I just want again to ask for help on what command to use to vlookup f1 group name in "/etc/group" matching f3 of it to "/etc/passwd" f4. I do need to display group name in the output of /etc/passwd without using awk or NR==FNR command. thank you while IFS=: read -r f1 f2 f3 f4 f5 f6 f7... (4 Replies)
Discussion started by: joonisio
4 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
MKNETID(8)							 Reference Manual							MKNETID(8)

NAME
mknetid - generate data for netid map SYNOPSIS
/usr/lib/yp/mknetid [ -q ] [ -h hosts ] [ -p passwd ] [ -g group ] [ -d domain ] [ -n netid ] /usr/lib/yp/mknetid --version DESCRIPTION
mknetid generates the netid.byname NIS map from the contents of the group(5), passwd(5), hosts(5) and netid files. It checks for multiple entrys of netids and warn for them or filters them out. It is only called by /var/yp/Makefile when rebuilding the NIS map. OPTIONS
-q This flag turns on 'quiet' mode, don't print a warning message when finding an duplicate netid entry. -h hosts The -h flag can be used to specify the use of another hosts file than the default /etc/hosts. -p passwd The -p flag can be used to specify the use of another passwd file than the default /etc/passwd. -g group The -g flag can be used to specify the use of another group file than the default /etc/group. -n netid The -n flag can be used to specify the use of another netid file than the default /etc/netid. -d domain The mknetid command uses the system domainname by default. If it is not set or you whish to override it, you must use the -d parame- ter. --version Prints the version number FILES
/etc/group groups file /etc/hosts hosts database /etc/netid netname database /etc/passwd password file SEE ALSO
passwd(8), group(5), hosts(5), passwd(5) AUTHOR
mknetid was written by Thorsten Kukuk <kukuk@suse.de>. YP Server August 2001 MKNETID(8)
All times are GMT -4. The time now is 01:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy