# Copy Info From Header To all Rows in CSV

**URL:** <https://discuss.elastic.co/t/copy-info-from-header-to-all-rows-in-csv/59396>\
**Category:** Logstash\
**Created:** [August 31, 2016, 7:13am UTC](https://discuss.elastic.co/t/copy-info-from-header-to-all-rows-in-csv/59396 "2016-08-31T07:13:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![uppaljs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/uppaljs/32/11535_2.png) [@uppaljs](https://discuss.elastic.co/u/uppaljs)\
**Post date:** [August 31, 2016, 7:13am UTC](https://discuss.elastic.co/t/copy-info-from-header-to-all-rows-in-csv/59396/1 "2016-08-31T07:13:31Z")

</div>

Hi,

I am trying to import a CSV file , in which first row in each file contains information about the file ( where it came from etc ) and next row onwards are records.

[HEADER ROW] HD;1;2;BGRCM;AFGAW;04682;20160831061512;+0300;20160831053847;+0200;3;10;;;;BGN;;3;5;;20160831061512;+0300;[HEADER ROW]

[DATA]  
MT;4XXXXXXXX;9XXXXXSSR;357807066041730;1;21;;TEST;;;20160830075130;+0300;0;;2;359898000100;4617306951892;;;;;;;;;;;;  
CI;E;;;;;;0;246024;  
MT;4XXXXXXXX;9FDFDD;XDSDEA;1;21;;TEST;;;20160830075132;+0300;0;;2;359898000100;4617306951903;;;;;;;;;;;;  
CI;E;;;;;;0;246024;  
MT;4XXXXXXXX;TEST;357807066041730;1;21;;TEST;;;20160830075136;+0300;0;;2;359898000100;4617306951911;;;;;;;;;;;;  
CI;E;;;;;;0;246024;

I want guidance on how to process the header row and include data from header row in all of the rows in the same file.

The problem is that the header row has different fields from the data.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 31, 2016, 7:16am UTC](https://discuss.elastic.co/t/copy-info-from-header-to-all-rows-in-csv/59396/2 "2016-08-31T07:16:50Z")

</div>

This isn't supported yet but there's an open pull request.

> <https://github.com/logstash-plugins/logstash-filter-csv/pull/12>

---

<div class="post-metadata">

**Author:** ![uppaljs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/uppaljs/32/11535_2.png) [@uppaljs](https://discuss.elastic.co/u/uppaljs)\
**Post date:** [August 31, 2016, 7:32am UTC](https://discuss.elastic.co/t/copy-info-from-header-to-all-rows-in-csv/59396/3 "2016-08-31T07:32:33Z")

</div>

wow - thanks for the quick response , but this sets the header row as column names - but i want to take that info and add it over to every line ( since the header field count and types are different from actual data count / type ).

Any way i can achieve that?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 31, 2016, 12:28pm UTC](https://discuss.elastic.co/t/copy-info-from-header-to-all-rows-in-csv/59396/4 "2016-08-31T12:28:43Z")

</div>

In that case the answer is: This isn't supported yet and there's no open pull request.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:40am UTC](https://discuss.elastic.co/t/copy-info-from-header-to-all-rows-in-csv/59396/5 "2017-07-06T04:40:37Z")

</div>


