makefile for loop 問題 - Linux

Table of Contents

想請教一下,如果有這樣一個text file,

Text.txt:

a1 b1 c1
a2 b2 c2
...

a100 b100 c100

要怎麼樣在makefile的 for loop 當中用三個變數分別代表 a1~a100 b1~b100 c1~c100呢?

用 for i in $$(cat Text.txt)這樣的寫法可以取出裡面的字串

但這樣沒辦法在一次迴圈中同時取得 a1 b1 c1

不得有沒有辦法在一次迴圈中同時取得a1 b1 c1的字串呢?

--

All Comments

Hedwig avatarHedwig2021-08-05
a=$(echo $i | cut -d' ' -f1) #其他改-f2跟-f3
另外你這是在問shell,不是makefile
Emily avatarEmily2021-08-08
*shell script
Hardy avatarHardy2021-08-08
了解了,謝謝。
Quintina avatarQuintina2021-08-09
能用 bash 的話,可以參考我這樣子的寫法:
https://pastebin.com/LN1HFcaP
用 while read 去一行一行 parsing
不知道有沒有更接近原 po 想要的樣子?