File field to replace lookup from another file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting File field to replace lookup from another file
# 1  
Old 04-19-2013
File field to replace lookup from another file

Hi All,

I don't know how to fast do this field replace that need lookup from another file to form the update resultSmilie

I want to do it by general shell script

Can anyone help to solve it ? Thanks for your kindly reply in advance.

CK

Last edited by ckwong99; 04-21-2013 at 10:34 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to print field from lookup file in output

The below awk uses $3 and $4 in search as the min and max, then takes each $2 value in lookup and compares it. If the value in lookupfalls within the range in searchthen it prints the entire line in lookup/ICODE]. What I can't seem to figure out is how to print the matching $5 from search on that... (4 Replies)
Discussion started by: cmccabe
4 Replies

2. Shell Programming and Scripting

Need to replace last field in a file,if first field matches

Hi, Need to replace last field in a file(/etc/passwd) ,if first filed matches with particular username. Scenario: cat testfor1 deekshi:x:7082:7082::/home/deekshi:/bin/bash harini1:x:7083:7083::/home/harini1:/bin/bash Here,if first field contains "deekshi", then i should replace... (4 Replies)
Discussion started by: Sumanthsv
4 Replies

3. Shell Programming and Scripting

Bash script to replace text file from a lookup file

Hi. I need assistance with the replacing of text into a specific file via a bash script. My bash script, once run, currently provides a menu of computer names to choose.The script copies onto my system various files, depending what computer was selected in the menu.This is working OK. Now, I... (1 Reply)
Discussion started by: jonesn2000
1 Replies

4. Shell Programming and Scripting

Lookup field values in two fixed format file in UNIX - not working

I have 2 fixed length files input#1 & input#2. I want to match the rows based on the value in position 37-50 in both files (pos 37-50 will have same value in both files). If any matching record is found then cut the value against company code & Invoice number from input file #1 (position 99 until... (3 Replies)
Discussion started by: Lingaraju
3 Replies

5. UNIX for Dummies Questions & Answers

Lookup field in map file

Hi, I have two questions which I would massively appreciate help with. 1. I am trying to insert a field into a file similar to the vlookup function in excel. In column 2 is a gene id for which i would like to insert the full name in the adjacent column. I have a map file (map.file) which... (1 Reply)
Discussion started by: genehersh
1 Replies

6. UNIX for Dummies Questions & Answers

Help with AWK - Compare a field in a file to lookup file and substitute if only a match

I have the below 2 files: 1) Third field from file1.txt should be compared to the first field of lookup.txt. 2) If match found then third field, file1.txt should be substituted with the second field from lookup.txt. 3)Else just print the line from file1.txt. File1.txt:... (4 Replies)
Discussion started by: venalla_shine
4 Replies

7. Shell Programming and Scripting

replace blank field in file 2 with content of file 1

Something like vlookup in excel, column 2 in file 2 is blank and should be replaced by column 2 in file 1 based on comparing column 1 in both files. file1 Code: 1234~abc~b~c~d~e~f~g~h~09/10/09 5678~def~b~c~d~e~f~g~h~12/06/10 8910~hij~b~c~d~e~f~g~h~03/28/13... (1 Reply)
Discussion started by: sigh2010
1 Replies

8. Shell Programming and Scripting

Help to replace a field in one file with a field from another file

I have to replace a field in one file with a field from other file. I came across this awk command to replace a field with one string nawk -F'|' -v OFS='|' '$2="replace"' temp2 > temp3 I need to have something like cut -f2 -d "|" temp1 (a field from other file) instead of 'replace' Is... (8 Replies)
Discussion started by: savant
8 Replies

9. Shell Programming and Scripting

replace a field in a CSV file

Hello all, I've a CSV file and need to replace 5th field if its value is "X". The exact requirement is to replace 5th field (column) with "Y" if a. it's value is "X" AND b. the line must start with ABC string i guess this can be done with awk. Pl help. For security reasons, the... (2 Replies)
Discussion started by: prvnrk
2 Replies

10. UNIX for Advanced & Expert Users

Clueless about how to lookup and reverse lookup IP addresses under a file!!.pls help

Write a quick shell snippet to find all of the IPV4 IP addresses in any and all of the files under /var/lib/output/*, ignoring whatever else may be in those files. Perform a reverse lookup on each, and format the output neatly, like "IP=192.168.0.1, ... (0 Replies)
Discussion started by: choco4202002
0 Replies
Login or Register to Ask a Question