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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...