How do I count the number of rows and columns in a file using bash?

后端 未结 13 1276
深忆病人
深忆病人 2020-12-23 03:07

Say I have a large file with many rows and many columns. I\'d like to find out how many rows and columns I have using bash.

13条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-23 03:57

    Simple row count is $(wc -l "$file"). Use $(wc -lL "$file") to show both the number of lines and the number of characters in the longest line.

提交回复
热议问题