title: How to get five files with most lines in the current directory by simplest way?
body: <p>There is such a shell command in the chapter &quot;transformational programming&quot; of &quot;The Pragmatic Programmer&quot;.</p>
  <p>Its function is to list the five files with the most lines in the current directory.</p>
  <pre><code>$ find . -type f | xargs wc -l | sort -n | tail -6 | head -5
  </code></pre>
  <pre><code>     470 ./debug.pml
       470 ./test_to_build.pml
       487 ./dbc.pml
       719 ./domain_languages.pml
       727 ./dry.pml
  </code></pre>
  <p>I'm trying to do the same thing with PowerShell，But it seems too wordy</p>
  <pre><code>(Get-ChildItem .\ | ForEach-Object {$_ | Select-Object -Property 'Name', @{label = 'Lines'; expression = {($_ | Get-Content).Length}}} |Sort-Object -Property 'Lines')|Select-Object -Last 5
  </code></pre>
  <p>I believe there will be a simpler way, but I can't think of it.</p>
  <p>How to get files with most lines in the current directory by simplest way using PowerShell?</p>
  <p>Of course, you don't need to use custom aliases and abbreviations to shorten the length. Although it looks more concise, it loses readability.</p>