I am extracting a string variable from a file and then print it to the screen. The problem is that using just echo works, but if I used echo -n, then nothing is printed. Here is an example:
$ Var=$(grep -a MrEdbType FileName)
$ echo $Var
Prot
$ echo -n $Var
$ 
Similarly, if I use printf, it works only if I add \n:
$ Var=$(grep -a MrEdbType FileName)
$ printf "%s" $Var
$
$ printf "%s\n" $Var
Prot
What is wrong with the string I am extracting? The file is a DICOM file containing a mixture of text and binary data, hence the use of -a option.
As suggested in the comments, using hexdump -C option generated this result:
$ Var=$(grep -a MrEdbType FileName | hexdump -C)
$ echo $Var
00000000 50 72 6f 74 0d 0a |Prot..| 00000006
