gpt4 book ai didi

linux - Bash - 从文件中读取行时打印第一列和第二列

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:46:32 25 4
gpt4 key购买 nike

<分区>

我有一个如下所示的测试文件。 (但实际文件有1000+行和很多列)

apple,2
mango,5
coconut,10

我想按如下方式打印这个文件。

I have apple and the count is 2
I have mango and the count is 5
I have coconut and the count is 10

我尝试使用awk -F ',' '{print $1}' while read line,但我没有得到实际输出。有人可以帮我解决这个问题吗?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com