我有一个使用while循环逐行读取文件的代码。在while循环中,我有一定的条件。有没有办法可以跳过当前行并根据条件读取下一行?让我准确一点:
while read Line
do
//some sample conditions
a=$Line
if [ "a" == "b" ]
//i want to go to the next line from this point.
done < **inputfile**
任何帮助将不胜感激。
答案 0 :(得分:3)
答案 1 :(得分:2)
怎么样:
while read Line
do
# some sample conditions
a=$Line
if [ "$a" == "$b" ] # I assume this is not "a" == "b"
# i want to go to the next line from this point.
read Line
a=$Line
done < **inputfile**