shell read 文件
Posted uxiuxi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了shell read 文件相关的知识,希望对你有一定的参考价值。
cat filename.txt |while read LINE do echo $LINE done # LINE在这里面只是随便一个变量,并不是内置 或者 #!/bin/bash while read aa do echo $aa done< filename.txt #这种格式看起来更好
#!/bin/bash myfile=filename.txt count=0 cat $myfile |while read LINE do echo $LINE let count=count+1 echo $count line done
[[email protected] prog]# cat filename.txt This is line number 1 This is line number 2 This is line number 3 This is line number 4 This is line number 5 This is line number 6 This is line number 7 This is line number 8 This is line number 9 This is line number 10
以上是关于shell read 文件的主要内容,如果未能解决你的问题,请参考以下文章