我需要逐行读取文件,直到文件结尾或遇到空白行。我在shell脚本中有以下代码,但不起作用:
while read line
do
commands
done < file.prop || $line == ""
可以这样做吗?
答案 0 :(得分:1)
是的,可以使用25.803.1.1,BALLOON,357
25.803.2.1,BALLOON,1941
25.803.3.1,BALLOON,3802
25.803.12.2,BALLOON,18783
25.803.22.2,BALLOON,20136
25.803.32.2,BALLOON,17560
25.803.14.4,BALLOON,2661
25.803.24.4,BALLOON,3472
25.803.34.4,BALLOON,4379
25.804.1.1,BANK,8410
25.804.2.1,BANK,7656
25.804.3.1,BANK,9822
25.804.12.2,BANK,9418
25.804.22.2,BANK,20522
25.804.32.2,BANK,14694
25.804.14.4,BANK,17569
25.804.24.4,BANK,16137
25.804.34.4,BANK,13835
命令轻松完成此操作。
break