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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...