如何打印文本文件每行的字符数 [英] How to print the number of characters in each line of a text file
本文介绍了如何打印文本文件每行的字符数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用 unix 命令打印文本文件每行中的字符数.我知道使用 powershell 很简单
I would like to print the number of characters in each line of a text file using a unix command. I know it is simple with powershell
gc abc.txt | % {$_.length}
但我需要 unix 命令.
but I need unix command.
推荐答案
使用 Awk.
awk '{ print length }' abc.txt
这篇关于如何打印文本文件每行的字符数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文