
因此,您不需要创建自己的循环,只需执行以下 *** 作:
grep "apple" fruits.txt
结果将是:
apple 1
apple 2
apple 3
apple 4
作为额外的:假设您将“spineapple666”添加到"fruits.txt文件中,那么您将在输出中看到这个。如果你不想这样:
grep -w "apple" fruits.txt
(-w表示只有整个单词可以是shown.)
欢迎分享,转载请注明来源:内存溢出

因此,您不需要创建自己的循环,只需执行以下 *** 作:
grep "apple" fruits.txt
结果将是:
apple 1
apple 2
apple 3
apple 4
作为额外的:假设您将“spineapple666”添加到"fruits.txt文件中,那么您将在输出中看到这个。如果你不想这样:
grep -w "apple" fruits.txt
(-w表示只有整个单词可以是shown.)
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)