我有两个输入文件,一个只包含数字,例如
范围.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
另一个文件有要求。例如
要求.txt
2s 4m
1s 10m
这意味着 2 组每组 4 名成员和 1 组 10 名成员。
输出应如下所示:
There is 1 apple;
There are 2 mangoes and 1 apple;
There are 3 mangoes and 1 apple;
There are 4 mangoes and 1 apple;
There is 5 apple;
There are 6 mangoes and 5 apple;
There are 7 mangoes and 5 apple;
There are 8 mangoes and 5 apple;
There is 9 apple;
There are 10 mangoes and 9 apple;
There are 11 mangoes and 9 apple;
There are 12 mangoes and 9 apple;
There are 13 mangoes and 9 apple;
There are 14 mangoes and 9 apple;
There are 15 mangoes and 9 apple;
There are 16 mangoes and 9 apple;
There are 17 mangoes and 9 apple;
There are 18 mangoes and 9 apple;
如何使用 awk 和 shell 脚本(甚至 perl)来实现这一点?我们拥有的 awk 版本是 /usr/xpg4/bin/awk。我不熟悉数组,这就是为什么需要一些帮助。
谢谢 !
PS:刚刚更新了将苹果“价值”附加到芒果“价值”的要求。