Splunk Search

problem with lookup command

abhayneilam
Contributor

Hi,

I have a master .csv file in which I have 10 rows, now I have one more child file which contains only 4 rows, now I want to lookup with the 4 rows in the 10 rows , if found, replace one of the column in master file

in my child.csv , only two columns "A" and "B"
in my master.csv, many columns, "A","B","C","D"

I have to match child.csv column "A" with master.csv column "A" and replace the value of column "B" of master.csv with the value of column "B" of child.csv

|inputlookup "masterfile.csv"|....| lookup "child.csv" field_name

but in this case what is happening is , value is getting replaced for the matched data but other values are becoming null

I dont want that value to become null, unmatched value will remain same, only matched value will replace

0 Karma

OL
Communicator

Hello,

Can you tried to use the "join type=left" yet?

The idea I have is something like:

|inputlookup "masterfile.csv"| join type=left A [| inputlookup "child.csv" | rename B as B_new]| eval B = if(isnotnull(B_new), B_new, B)| outputlookup "masterfile.csv"

Hope it helps.
Regards,
Olivier

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...