Getting Data In

How can I combine two CSV files?

Sagar0511
Explorer

Hi Everyone,

I want to combine data from two .csv files which are "CBIG-SIN Updated" and "Hostnames Files" files names and the output should be displayed in one file with relevant information of each file. In both the files the Header names are different.
I have tried the commands such as inputlookup, inputcsv and then the append with the next file. But none of them are working.

0 Karma

Sagar0511
Explorer

Please suggest

0 Karma

niketn
Legend

@Sagar0511, can you give what are the field names in the two CSV and how do you want the output with sample mock data in tabular format?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

Sagar0511
Explorer

Header of file1: Date Time Interface Origin Type Action Service Source Port Source Destination Protocol Rule Rule Name Current Rule Number User Information Product Source Machine Name Source User Name

Header of file2: Name Type Location FW1 IP-Address Netmask NAT-Address NAT-Type Members Comment

In the result/Output I want both the result combining of File1 and File2. So it will be easy to search the hostnames/IP's

CBIG_SIN is the CSV file name.

0 Karma

koshyk
Super Champion

can you post sample data of both the files and final sample output you require? We have no clue what you mean by CBIG_SIN until there is some sample data.

0 Karma

Sagar0511
Explorer

Please find the below same Header and data for both the files

Header and data of first csv file

Number-Date-Time-Interface-Origin-Type-Action-Service-Source Port-Source-Destination-Protocol-Rule-Rule Name-Current Rule Number-User-Information-Product-SourceMachineName-Source User Name

1-16-Oct-17-23:58:58-eth2-xxxx-Log-Drop-xxxx-38611-hostxx.xx.xx.xx.static.arubacloud.de-xx.xx.xxx.xxx udp-26-26CBIG-SIN-Consolidation-NA-NA-Security Gateway/Management-NA-NA

2-16-Oct-17-23:59:00-eth1-xxxx-Log-Accep-xxxx-62006-Host_xx.xx.xx.xx.-SINDSITNCDB03AV_xx.xxx.xxx.xxx tcp-271- 271-CBIG-SIN-Consolidation-NA-inzone Internal outzone Externalservice_id: TCP_135-Security Gateway/Management-NA-NA

Header and Data of second csv file

Nr-Name-Type-Location-FW1-IP-Netmask-NATAddress-NATType-Members-Comment

1 Attack_IP_xx.x.xx.xxx host-NA-NA-xx.x.xx.xxx-NA-NA-NA-NA-NA

2 xx.xx.xx.xxx group-NA-NA-NA-NA-NA-NA-Net_xx.xx.x.x Net_xx.xx.x.x-x-NA

3 UFTP_xx.xx.xx.xxx host-NA-NA-xx.xx.xx.xxx-NA-NA-NA-NA-NA

0 Karma

Sagar0511
Explorer

Header of file1: Date Time Interface Origin Type Action Service Source Port Source Destination Protocol Rule Rule Name Current Rule Number User Information Product Source Machine Name Source User Name

Header of file2: Name Type Location FW1 IP-Address Netmask NAT-Address NAT-Type Members Comment

In the result/Output I want both the result combining of File1 and File2. So it will be easy to search the hostnames/IP's

CBIG_SIN is the CSV file name.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...