Shortest Script Challenge: Value Lookup Across Objects

Previous challenges listed here.

With this starting point:

$C='Name,2000sCount,2000sRank Emily,223658,1 Madison,193134,2 Emma,181229,3 Olivia,155991,4 Hannah,155670,5 Abigail,150853,6 Isabella,149485,7 Samantha,134246,8 Elizabeth,133375,9 Ashley,133010,10' -split ' '| ConvertFrom-Csv $B='Name,1990sCount,1990sRank Jessica,303086,1 Ashley,301801,2 Emily,237227,3 Sarah,224310,4 Samantha,223995,5 Amanda,191077,6 Brittany,190812,7 Elizabeth,172624,8 Taylor,169014,9 Megan,160355,10' -split ' '| ConvertFrom-Csv $A='Name,1980sCount,1980sRank Jessica,469472,1 Jennifer,440859,2 Amanda,369716,3 Ashley,352171,4 Sarah,272607,5 Stephanie,218139,6 Melissa,217903,7 Nicole,210477,8 Elizabeth,198965,9 Heather,191859,10' -split ' '| ConvertFrom-Csv 

(source)

Using as few characters as you can, produce the following data:

Name 1980sCount 1980sRank 1990sCount 1990sRank 2000sCount 2000sRank ---- ---------- --------- ---------- --------- ---------- --------- Abigail 150853 6 Amanda 369716 3 191077 6 Ashley 352171 4 301801 2 133010 10 Brittany 190812 7 Elizabeth 198965 9 172624 8 133375 9 Emily 237227 3 223658 1 Emma 181229 3 Hannah 155670 5 Heather 191859 10 Isabella 149485 7 Jennifer 440859 2 Jessica 469472 1 303086 1 Madison 193134 2 Megan 160355 10 Melissa 217903 7 Nicole 210477 8 Olivia 155991 4 Samantha 223995 5 134246 8 Sarah 272607 5 224310 4 Stephanie 218139 6 Taylor 169014 9 

Rules:

  1. You don’t need to | Format-Table
  2. The order of data doesn’t matter
  3. The order of the properties doesn’t matter
  4. The data does need to be in the form of objects, e.g. [pscustomobject]
  5. No extraneous output, e.g. errors, warnings, or text not in the required output
  6. Do not put anything you see or do here into a production script.
  7. Please explode & explain your code so others can learn.
  8. No uninitialized variables.
  9. Script must run in less than 10 seconds
  10. Enjoy yourselves!

Leader Board:

submitted by /u/bis
[link] [comments]

Leave a Reply