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
Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...