I have a text file with records broken down into two lines. I want to put them back in one line. Below is an example
=== Sample Start ===
First Name
Last Name
Heath
Packer
Samantha
Hugh
First Name
Last Name
Gary
Evans
Shawn
Owen
=== Sample End ===
Expected output:
First Name Last Name
Heath Packer
Samantha Hugh
Gary Evans
Shawn Owen
In tabular format. Note that the headers are also broken down into two lines and need to be put back together. This example includes two tables separated with a line break. When we put together, I want to keep only the first headers and remove the other.
If you are confident the structure will be consistent this should work
We use an alternating 0 then 1 0 then 1 field to determine first or last name i call pairId, then i use the pair id in a multirow to make a recordID where every time pairID = 0 increase the recordID so we have a field that looks like 1,1,2,2,3,3 etc. Then Pivot with pairID being the headers grouped by recordID filter rename the columns and filter out duplicate headers in the data.
This is def overkill, but here is a third way of doing it.
Nice use of the Make Columns Tool @flying008 !
User | Count |
---|---|
19 | |
15 | |
13 | |
9 | |
8 |