I have result file where I need to read the value of "rx cells " the report file is as given as below: Content of test.log file is as follows:
co_result=test.log
ZyXEL IES-1000> statistics port 12 0 33
[adsl channel 12-0/33]
tx packets: 56
rx packets: 60
tx rate : 0
rx rate : 0
tx cells : 468
rx cells : 1707
errors : 0
ZyXEL IES-1000>
I am using the following command to read the rx cells value:
cells=$(grep -e 'cells' $co_result | cut -d: -f2 | awk '{print $1}'| awk 'NR%2{printf $0"";next;}1')
echo "Var_value: $cells"
but when I tried to run the above 2 commands in a file. I am getting following output , where the first few characters in echo is not displaying:
1707value: 530
I am expecting only 1707 in $cells variable but it prints wrongly. I am not understanding the issue . Could you please help to fix it.