Start-Transcript -Path result.csv $oc = Import-Csv oldcats.csv $nc = Import-Csv newcats.csv #$doc=@{} $dnc=@{} $dncs=@{} $found=@{} #foreach($a in $oc){ # $doc.Add($a.PrimaCatTypeName.ToLower()) #} #approaching :D #recipe_type_id,recipe_category_id,recipe_type_description foreach($a in $nc){ $k=$a.recipe_type_description.ToLower() $v="$($a.recipe_type_id),$($a.recipe_category_id), $($a.recipe_type_description)" if (-not $dnc.containsKey($k)){ $dnc.Add($k,$v ) } if (-not $dncs.containsKey($k+"s")){ $dncs.Add($k+"s",$v ) } } #printing oldcat results foreach($a in $oc){ $k=$a.PrimaCatTypeName.ToLower() $head="$($a.PrimaCatTypeId), `"$($a.PrimaCatTypeName)`"," if ($dnc.containsKey($k)){ Write-Host "$head $($dnc[$k])" ; $found.Add($k,$k) } elseif ($dncs.containsKey($k)){ Write-Host "$head $($dncs[$k])" ; $found.Add($k,$k) } else { Write-Host $head } } #printing new oldcat Write-Host ":::New cats not found:::" foreach($a in $nc){ $k=$a.recipe_type_description.ToLower() if (-not $found.containsKey($k) -and -not $found.containsKey($k+"s") ){ $v="$($a.recipe_type_id),$($a.recipe_category_id), `"$($a.recipe_type_description)`"" Write-Host $v } } Stop-Transcript
Wednesday
powershell csv
Subscribe to:
Post Comments (Atom)
imagemagic add text to image
rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...
-
Error:The element 'Schedule' has invalid child element 'RecurrenceRule'. List of possible elements expected: 'Occurring&...
-
Perfect blog post must include following elements (from 1 to 13): 1.Big catchy header in 30px font size 2.First copy of social links and com...
-
SetKeyDelay , 75 , 75 ;Exits AutoHotKey application. $^CapsLock:: ExitApp return ;Pauses AutoHotKey Script. F6:: Pause , Toggle, 1 $x:: ...
No comments:
Post a Comment