Linux下shell取得字符串行数与指定字符串长度

有某个文本文件is36.txt,需要取得字符串行数指定字符串长度

linuxshell取得字符串行数:

  • cat is36.txt | wc -l

Linux下shell取得指定字符串长度(默认第一行):

  • cat is36.txt | wc -L

Linux下shell取得指定字符串长度(2p即第二行):

  • sed -n '2p' is36.txt | wc -L

Tags: linux, shell, 字符串行数, 指定字符串长度

上一篇: Windows命令行下终止进程的命令taskkill与tskill使用方法
下一篇: Linux下shell支持中文显示的方法

相关文章

发表评论