I'm having a problem when trying to echo a variable. The echo output of the variable is different than the output of the command. Why any thing like this happen? I suppose it may have something to do with the text, since this problem didn't appear when applying this on a different text.
me@myPC:~/some/directory/$ grep "frag" link | awk '{print$2}'
KETENE
OH
H2O
HCCO
CO
CH2OH
H
CH(OH)CO
(HCO)2
HCO
CH2O
CH3O
CO2
CH3
me@myPC:~/some/directory/$ frag_list=$(grep "frag" link | awk '{print$2}')
me@myPC:~/some/directory/$ echo $frag_list
CH3O)2CO
frag_list=$(dos2unix < link | awk '/frag/{print $2}'); printf '%s\n' "$frag_list"
– Stéphane Chazelas Oct 06 '17 at 10:21