I have a file named test. In that file I have:
Now in my program I have this:
The output is:
Without IFS=, it looks like this:
The output I'm looking for is:
Could someone please explain why it is that b comes out on the 3rd line?
The purpose is to have $i set to var1, and then the next iteration to var2, have those run commands, then put back into a file. But since I can't explain how b ends up displaying without cause, I can't continue.
Thanks!
Code:
a,1
b,2
c,3
d,4
Now in my program I have this:
Code:
clear
mc=0
IFS=,
for i in `cat test` ; do
mc=$(( $mc + 1 ))
echo $mc $i
The output is:
Code:
1 a
2 1
b
3 2
c
4 3
d
5 4
Without IFS=, it looks like this:
Code:
1 a,1
2 b,2
3 c,3
4 d,4
The output I'm looking for is:
Code:
1 a
2 1
3 b
4 2
5 c
6 3
7 d
8 4
Could someone please explain why it is that b comes out on the 3rd line?
The purpose is to have $i set to var1, and then the next iteration to var2, have those run commands, then put back into a file. But since I can't explain how b ends up displaying without cause, I can't continue.
Thanks!