Linux:wcコマンドでファイルの最長行の長さをカウントする方法

スポンサーリンク

wcコマンドでファイルの最長行の長さをカウントする方法

wcコマンドでファイルの最長行の長さをカウントするには-Lオプションを指定します。

 

オプションの説明

 -L, --max-line-length print the maximum display width

 

-Lオプションを指定した場合

$ cat test.txt
a
$ wc -L test.txt
1 test.txt

$ cat test2.txt
a
abcde
abc de
$ wc -L test2.txt
6 test2.txt

$ cat test3.txt
a
abcde
abc de
あいうえお
$ wc -L test3.txt
10 test3.txt