i have this text
hello world@helloworld@/dev/zero@inout/helloworld.out
hello world with warnings@warnings@/dev/zero@inout/helloworld.out
echo test@myecho@inout/echo.in@inout/echo.out
echo failtest@myecho@inout/echo.in@inout/helloworld.out
memleaks pass@memleaks@inout/memleaks.6.in@inout/memleaks.6.out
memleaks fail@memleaks@inout/memleaks.11.in@inout/memleaks.11.out
i want to run a bash loop that in each run i will read one line and will get 4 vars each untill the @ (without the @) and to know what line number i am i got so far
(( index=0 ))
for read line
do
(( index+=1 ))
var1=
var2=
var3=
var4=
done
what i want to get is
var1=hello world
var2=helloworld
var3=/dev/zero
var4=inout/helloworld.out
and is there a way to do it in 1 line?