我有一个字符串:Gatto piu bello anche cane在文件中.我使用awk分割它并将其放入数组.但输出的顺序不正确.我的代码是:
while (getline < "'"$INPUTFILE"'") {
text = $0;
}
split (text,text_arr," ");
for (i in text_arr) {
print text_arr[i];
}
Run Code Online (Sandbox Code Playgroud)
$INPUTFILE 是该字符串的文件.
但是这段代码的输出是:
anche
cane
Gatto
piu
bello
Run Code Online (Sandbox Code Playgroud)
我不知道是什么问题.