我有這樣的文字解析文本
hello [email protected]@/dev/[email protected]/helloworld.out
hello world with [email protected]@/dev/[email protected]/helloworld.out
echo [email protected]@inout/[email protected]/echo.out
echo [email protected]@inout/[email protected]/helloworld.out
memleaks [email protected]@inout/[email protected]/memleaks.6.out
memleaks [email protected]@inout/[email protected]/memleaks.11.out
我想運行一個bash循環,在每一輪我會讀一行,並會得到4瓦爾每個 直到在@(不帶@) 要知道我是什麼行號 我走到這一步,
((index=0))
for read line
do
((index+=1))
var1=
var2=
var3=
var4=
done
我想要得到的是
var1=hello world
var2=helloworld
var3=/dev/zero
var4=inout/helloworld.out
,有沒有辦法做到1行?
您可以編輯顯示在VAR1您的預計產量,VAR2等 – Hackaholic 2014-11-02 19:03:02
是你說得對,我加入這 – JohnnyF 2014-11-02 19:06:59
的http://計算器。 com/questions/918886/how-do-i-split-a-string-on-a-delimiter-in-bash – stark 2014-11-02 19:22:05