so I have a file step1 containing data like
field [T]:0.000
heatstart [s]: 1.50E+1
a[a],b[b],[c[c],d
1.02E-1,2.31E-1,...
1.50E+1,4.26E-1,...
...
and a file called var4 containing only the entry 1.50E+1
. I used mapfile to get this entry as a variable
mapfile -t var<var4
which grep can use to search in the data to give me the line number
grep -n "${var[0]}" step1
Using this gives me only the entry in line 2 of step1, not the entry in line 5. If I copy the entry from line 5 into another line at the beginning, I don't get it with grep either, but if I copy it somewhere in the middle of a line grep gets it. But if I paste the file step1 to itself, I don't get the other results.
I also tried getting the variable for 1.50E+1 with sed and cut as
sed -n '2p' < step1>var3
var4="$(cut -c15- var3)"
but this results into the same problem. There is no space in front of the number in the variable, because even if I cut so much of that the 1 isn't witin the variable anymore, I don't get all results. Does someone know why this happens or how to get around this?