0

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
Boyang
  • 1

1 Answers1

0
frag_list=`cat link | grep "frag" | awk '{print$2}'` 

should do it