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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...