3

bash里如何循环读取文件

 3 years ago
source link: https://www.seis-jun.xyz/read-file-bash
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

bash里如何循环读取文件

发表于

2021-03-09 分类于 Linux

阅读次数: 13 Valine: 0
本文字数: 173 阅读时长 ≈ 1 分钟

  Bash操作简单,可以处理简单的计算等。有些时候会遇到文件的读取问题,那如何对文件进行循环逐行读取呢?

  这样就可以了:

while read -r line
do
array=(${line///})
echo ${array[1]}
done < the_file
有疑问或建议请发邮件到[email protected]

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK