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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...