{"id":1274,"date":"2015-01-08T15:48:29","date_gmt":"2015-01-08T13:48:29","guid":{"rendered":"http:\/\/vady.kiev.ua\/tweets\/?p=1274"},"modified":"2015-01-08T15:50:15","modified_gmt":"2015-01-08T13:50:15","slug":"powershell-select-first-1-line-on-a-large-file","status":"publish","type":"post","link":"https:\/\/vady.kiev.ua\/tweets\/1274","title":{"rendered":"Powershell: select first 1 line on a large file"},"content":{"rendered":"<p><a href=\"http:\/\/powershell-tips.blogspot.com\/2011\/05\/display-top-n-lines-or-last-1n-lines-of.html\" title=\"Powershell Tips: Display top n lines or last n lines of a file\" target=\"_blank\">\u0422\u0430\u043a<\/a> \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u0441\u044c \u0444\u0430\u0439\u043b, \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e:<\/p>\n<p><code>Get-Content \".\\file.txt\" | Select -First 1<br \/>\nGet-Content \".\\file.txt\" -TotalCount 1<\/code><\/p>\n<p><a href=\"http:\/\/stackoverflow.com\/a\/11369905\/1172850\" title=\"Powershell tips: select -first 1 on a large file\" target=\"_blank\">\u0427\u0435\u0440\u0435\u0437 .NET \u043b\u0438\u0431\u044b<\/a> \u0431\u044b\u0441\u0442\u0440\u0435\u0435:<\/p>\n<p><code>$reader = [System.IO.File]::OpenText(\"file.txt\")<br \/>\n$line = $reader.ReadLine()<br \/>\n$reader.Close()<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0422\u0430\u043a \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u0441\u044c \u0444\u0430\u0439\u043b, \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e: Get-Content &#8220;.\\file.txt&#8221; | Select -First 1 Get-Content &#8220;.\\file.txt&#8221; -TotalCount 1 \u0427\u0435\u0440\u0435\u0437 .NET \u043b\u0438\u0431\u044b \u0431\u044b\u0441\u0442\u0440\u0435\u0435: $reader = [System.IO.File]::OpenText(&#8220;file.txt&#8221;) $line = $reader.ReadLine() $reader.Close()<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1],"tags":[75,134,176],"class_list":["post-1274","post","type-post","status-publish","format-standard","hentry","category-misc","tag-code","tag-powershell","tag-tips"],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7bIIX-ky","jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/vady.kiev.ua\/tweets\/wp-json\/wp\/v2\/posts\/1274","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vady.kiev.ua\/tweets\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vady.kiev.ua\/tweets\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vady.kiev.ua\/tweets\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vady.kiev.ua\/tweets\/wp-json\/wp\/v2\/comments?post=1274"}],"version-history":[{"count":3,"href":"https:\/\/vady.kiev.ua\/tweets\/wp-json\/wp\/v2\/posts\/1274\/revisions"}],"predecessor-version":[{"id":1277,"href":"https:\/\/vady.kiev.ua\/tweets\/wp-json\/wp\/v2\/posts\/1274\/revisions\/1277"}],"wp:attachment":[{"href":"https:\/\/vady.kiev.ua\/tweets\/wp-json\/wp\/v2\/media?parent=1274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vady.kiev.ua\/tweets\/wp-json\/wp\/v2\/categories?post=1274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vady.kiev.ua\/tweets\/wp-json\/wp\/v2\/tags?post=1274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}