Concatenate CSV files and skip SECOND row - powershell

I'm using PowerShell to concatenate social media log files and Facebook, in their infinite wisdom, have added a SECOND row to their header line.
I currently use this:
Get-ChildItem -Filter *.csv | Select-Object -ExpandProperty FullName | Import-Csv | Export-Csv $FileOut -NoTypeInformation -Append
to concat Twitter logs which works great. Is there a 'simple' way to simply skip the second line in all the files during concatenation? I know I can do some data work after the fact to remove the second row (since it's static) from the resulting file, but I'd rather see if I can just get rid of it from the get go.
I can share the first two lines if anyone is curious, but it's exceptionally long and annoying =D
ETA: Ideally, I either need to figure out
a) how to take that concatenation line and have it know that the header is two lines long and then I can just remove the second line from the resulting file
OR
b) how to get the concatenation process to skip the 2nd line in each file without lots of work.
Here's the first two lines of the file (all that's really relevant, since the second line is the one I want to skip):
"Post ID",Permalink,"Post Message",Type,Countries,Languages,Posted,"Audience Targeting","Lifetime Post Total Reach","Lifetime Post organic reach","Lifetime Post Paid Reach","Lifetime Post Total Impressions","Lifetime Post Organic Impressions","Lifetime Post Paid Impressions","Lifetime Engaged Users","Lifetime Matched Audience Targeting Consumers on Post","Lifetime Matched Audience Targeting Consumptions on Post","Lifetime Negative Feedback from Users","Lifetime Negative Feedback","Lifetime Post Impressions by people who have liked your Page","Lifetime Post reach by people who like your Page","Lifetime Post Paid Impressions by people who have liked your Page","Lifetime Paid reach of a post by people who like your Page","Lifetime People who have liked your Page and engaged with your post","Lifetime Organic views to 95%","Lifetime Organic views to 95%","Lifetime Paid views to 95%","Lifetime Paid views to 95%","Lifetime Organic Video Views","Lifetime Organic Video Views","Lifetime Paid Video Views","Lifetime Paid Video Views","Lifetime Average time video viewed","Lifetime Video length","Lifetime Post Stories by action type - like","Lifetime Post Stories by action type - share","Lifetime Post Stories by action type - comment"
,,,,,,,,"Lifetime: The number of people who had your Page's post enter their screen. Posts include statuses, photos, links, videos and more. (Unique Users)","Lifetime: The number of people who had your Page's post enter their screen through unpaid distribution. (Unique Users)","Lifetime: The number of people who had your Page's post enter their screen through paid distribution such as an ad. (Unique Users)","Lifetime: The number of times your Page's post entered a person's screen. Posts include statuses, photos, links, videos and more. (Total Count)","Lifetime: The number of times your Page's posts entered a person's screen through unpaid distribution. (Total Count)","Lifetime: The number of times your Page's post entered a person's screen through paid distribution such as an ad. (Total Count)","Lifetime: The number of unique people who engaged in certain ways with your Page post, for example by commenting on, liking, sharing, or clicking upon particular elements of the post. (Unique Users)","Lifetime: The number of people who matched the audience targeting that clicked anywhere in your post on News Feed. (Unique Users)","Lifetime: The number of clicks anywhere in your post on News Feed from the user that matched the audience targeting on it. (Total Count)","Lifetime: The number of people who have given negative feedback to your post. (Unique Users)","Lifetime: The number of times people have given negative feedback to your post. (Total Count)","Lifetime: The number of impressions of your Page post to people who have liked your Page. (Total Count)","Lifetime: The number of people who saw your Page post because they've liked your Page (Unique Users)","Lifetime: The number of paid impressions of your Page post to people who have liked your Page. (Total Count)","Lifetime: The number of people who like your Page and who saw your Page post in an ad or sponsored story. (Unique Users)","Lifetime: The number of people who have liked your Page and clicked anywhere in your posts. (Unique Users)","Lifetime: Number of times your video was viewed to 95% of its length without any paid promotion. (Unique Users)","Lifetime: Number of times your video was viewed to 95% of its length without any paid promotion. (Total Count)","Lifetime: Number of times your video was viewed to 95% of its length after paid promotion. (Unique Users)","Lifetime: Number of times your video was viewed to 95% of its length after paid promotion. (Total Count)","Lifetime: Number of times your video was viewed for more than 3 seconds without any paid promotion. (Unique Users)","Lifetime: Number of times your video was viewed for more than 3 seconds without any paid promotion. (Total Count)","Lifetime: Number of times your video was viewed more than 3 seconds after paid promotion. (Unique Users)","Lifetime: Number of times your video was viewed more than 3 seconds after paid promotion. (Total Count)","Lifetime: Average time video viewed (Total Count)","Lifetime: Length of a video post (Total Count)","Lifetime: The number of stories created about your Page post, by action type. (Total Count)",,

For 5.1, you can remove specific indexes from an arraylist. The method doesn't output to the pipeline, so it requires a loop:
foreach ($file in (Get-ChildItem -Filter *.csv).FullName) {
$csv = [System.Collections.ArrayList](Import-Csv $file)
$csv.RemoveAt(1)
$csv | Export-Csv $FileOut -NoTypeInformation -Append
}

-Skip/-SkipIndex should work just fine, however Facebook, in their infinite wisdom, have decided to make the items in the first row not unique across the board, so I'm going to have to not go the easy route of just deleting the second row and instead removing the first two lines and adding my own headers so I can work with the data when it's all done.

Related

Facebook fan count on a given date

I am not a programmer and I have literally no idea about the Facebook API. However, I need to collect some data from six different Facebook pages for my thesis, and I'm not the admin of them.
I've managed to get all the statuses, likes, comments of the 6 Facebook pages from a year using:
https://api.facebook.com/method/fql.query?query=select permalink,like_info,comment_info,share_info,created_time from stream where source_id={fan-page-ID} and created_time < {time-in-Unix-timestamp} and actor_id={fan-page-ID} ORDER BY created_time DESC LIMIT 20000&access_token ={your-access-token}
Now I need to get the number of fans the six pages had during the year (the variation). I would like to know how many fans the page had on a certain date. I've found this:
http://api.facebook.com/method/fql.query?format=xml&query=select fan_count,name from page where page_id={fan-page-ID}
And it works but it gives me the number of fans for today, not a certain date that I want. Any idea how can I achieve that? It would be amazing if I could get an XML so I can open it in excel for further analysis.

Merge Website Article Likes and Facebook Post Likes

So I have an online publication with a like button for each article page, e.g. http://mafysh.com/%D9%A1%D9%A2-%D9%85%D9%86%D8%B7%D9%82%D8%A9-%D8%B3%D9%8A%D8%A7%D8%AD%D9%8A%D8%A9-%D9%85%D9%87%D9%85%D8%B4%D8%A9-%D9%81%D9%8A-%D9%85%D8%B5%D8%B1-%D9%85%D8%AA%D8%B9%D8%B1%D9%81%D8%B4-%D8%B9%D9%86%D9%87/
My problem is it looks like that the article post on my Facebook Fanpage is not merged with that one on the website, e.g. on https://www.facebook.com/mafysh you will find the same first post with half the number of shares, though it links with the same url, on the website its 25 shares, and on the post it's 12 post.
The "merging" doesn't work like you imagine. Although the likes, shares and comments from the link on the FB page indeed sum up to the total number of likes/shares of your on-site button, but it doesn't work the other way - if user clicked the share button on your website it will not increment the numbers on your fanpage.
In the moment you asked this questions your numbers might be the following: 10 likes + 0 comments + 12 shares (all on the fanpage) + 3 button shares (on your website) = 25 total "shares".

What exactly does the 'Page Consumptions' Facebook metric mean?

Page Consumptions - The number of times people clicked on any of your content without generating a story (total count). Daily, weekly, monthly, by consumption type.
This is referring to the number of times that people have clicked on content posted on your page without generating a post in their own feed.
For example, I might click on a link on your page without sharing the link in my own feed (such that nothing related to your content appears in my feed). This counts as a consumption not generating a story.

Facebook API definitions explained

I have the list of definitions for fields in the Facebook API.
http://developers.facebook.com/docs/reference/fql/insights/
The definitions are a brief and not explained. Is there a more detailed description of these somewhere? Specifically:
What is the difference between 'page_posts_impressions' and 'page_impressions'?
I see that the 2nd is larger than the 1st. What other kind of page impression would a user get that is not in their feed?
Also, how are organic and viral defined?
I thought that organic might be generated by the page's postings and viral might be generated by those posting stories about the page.
So I thought that organic + viral = total
I can see on some days this is true but not on others.
Thanks
John
From the page you linked:
page_posts_impressions - The number of impressions that came from all of your posts
page_impressions - The total number of impressions seen of any content associated with your Page
The second includes places users were exposed to your page other than via posts the page itself made, including a user's friends writing on the page wall, sharing a link to the page, etc

facebook insights api: difference between items ending in "unique" and "source"

I have played with Facebook's insights api and I can see I can get a lot of information about a page.
I'm trying to make sense what is the difference between elements named like so:
"page_fan_adds" vs "page_fan_adds_unique" vs "page_fan_adds_source"
page_fan_adds - Daily New Likes of your Page (Total Count)
page_fan_adds_unique - Daily New Likes of your Page (Unique Users)
page_fan_adds_source - Daily This is a breakdown of the number of likes from the most common places where users can like your Page. (Total Count)
I've seen the "description" for each one of them, but it's not very clear on what is the difference.
Many thanks,
Vladimir
You need to divide the sort of action you are talking about (for example-a like) to three different categories:
page_fan_adds - The total number of likes your app/page has received.
page_fan_add_unique - The total number of likes your application received from unique users (this is very common in online advertising analytics-for example, if a visitor from the same IP clicked on a banner twice, only one of the clicks will be considered a unique click. In Facebook, however, I suppose this has something to do with people liking, unliking, and then liking your page/app again-double check on this anyways).
page_fan_adds_source - You need to understand that a like can happen both in and out of Facebook. An inside like, could be a like while a user is in Facebook and reaches your page/app. An outside like could be obtained by a one of the many available Social Plugins, for example.
If you could specify exactly what are you currently building, I can try, and give you the best answer possible.
As per the fact you are trying to put all of this in a graph, I would pull all of these three fields, and show them in 2 graphs:
Total number of likes and unique likes-this will be a graph with two lines-on the x axis this will be the date, and on the y axis the number of likes. A like this, the user will be able to see the number of total likes in comparison to to the total number of unique likes.
Total number of likes by source - this will divide the number of likes between the different sources they came from-outside websites, Facebook, mobile phone apps etc. This will be (for example) the data of the last 30 days-on the y axis there will be the number of likes and on the x axis there will be the source.