LoginSignup
0
0

More than 1 year has passed since last update.

PowerShellでファイルのレコード長を調べるワンライナーコマンド

Posted at

元ネタは、google先生でたくさん転がってるけど自分用に
編集したので備忘録的にまとめた。

ファイルの種類により、 -Encoding を気を付けましょう。

Get-ChildItem -Filter "*.csv" -Recurse | ForEach-Object { $filename = $_.Name; Get-Content $_.FullName -Encoding Ascii | ForEach-Object { $i = 0 } { $i++; [PSCustomObject] @{ filename = $filename; length = $_.Length} } } | Sort-Object filename -Unique | Format-Table -AutoSize
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0